guzzle http client code example
Example 1: use guzzle http client laravel
public function putGuzzleRequest()
{
$client = new \GuzzleHttp\Client();
$url = "http://myexample.com/api/posts/1";
$myBody['name'] = "Demo";
$request = $client->put($url, ['body'=>$myBody]);
$response = $request->send();
dd($response);
}
Example 2: guzzle login example
$post_data = array(
'title' => 'My work',
'description' => 'This is a request created using curl',
'submit' => 'submit',
);
$response = $http_client->post('/create.php', array(), $post_data)->send();