Hi I am trying to use Guzzle in my laravel application to send some data to a remote application. When i try to use $client->post('url') it works fine but whenever i use any of async functions like postAsync, sendAsync i get the BadMethodException.
local.ERROR: exception 'BadMethodCallException' with message 'Unknown method, sendAsync' in /home/lycan/Documents/workspace/my_project/vendor/guzzlehttp/guzzle/src/functions.php:324
My method is below
private function sendDataToRemoteApplication()
{
$client = new \GuzzleHttp\Client();
$url='http://localhost:9000/submitResults/?key1=valu1&key2=22';
$request = new Request('POST', $url);
$promise = $client->sendAsync($request)->then(function ($response) {
echo 'I completed! ' . $response->getBody();
});
$promise->wait();
}
i followed everything from the documents so it should work ! Tried to find out the solution on google but didn't find a link where any one faced this issue....( i would consider my self lucky if i am the first to face this issue though :D ) . Can one please suggest what is the problem.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire