Reputation: 421
When I perform this post call in my terminal with curl everything works great I see the post call coming in:
my curl call:
curl -X POST https://requestloggerbin.herokuapp.com/bin/a4d73cbb-2ddc-4fc7-ac38-60c2fac7e015 -d '{"test": "foo"}'
I am trying to replicate this call in my laravel app with guzzle, but I don't see the post call coming in and I get no error messages whatsoever so I have no idea what's going wrong.
My guzzle call:
$client = new Client();
$request = $client->post(
'https://requestloggerbin.herokuapp.com/bin/a4d73cbb-2ddc-4fc7-ac38-60c2fac7e015',
['body' => ['foo' => 'bar']]
);
$response = $request->send();
What am I doing wrong here?
Upvotes: 0
Views: 790
Reputation: 1673
$response = $request->send();
Which is not required at all .
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('http://localhost.com/23', ['body' => $requestXmlBody]);
$result = $response->getBody()->getContents();
$result1 = simplexml_load_string($result);
Upvotes: 1