laravel Guzzle 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: laravel 6 make http request
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.github.com/user', ['auth' => ['user', 'pass']]);
echo $res->getStatusCode();
echo $res->getBody();