I've been trying to get UPS shipping rates using Guzzle to make the request but I'm not sure what I'm doing wrong.
I'm using XML for the request object and the same object works fine in a cURL request. But when passing it with Guzzle I get nothing back.
I've used these two methods for making the request:
$this->client = new GuzzleHttp\Client();
$resp = $this->client->request('POST',$url,['Content-Type' => 'text/xml; charset=UTF8'],$schema);
And
$resp = $this->client->post($url,['body' => $schema]);
Then I try getting the response from UPS with:
$rates = $resp->getBody();
But no matter what I do $rates is empty.
Anyone know what I'm doing wrong?
Turns out that in order to get the response you have to use:
$rates = $resp->getBody()->__toString();
Not sure why this is necessary but it works.