0
Q:

laravel http client

use Illuminate\Support\Facades\Http;

$response = Http::get('http://test.com');
1
$client = new GuzzleHttp\Client();
$res = $client->get('https://api.github.com/user', ['auth' =>  ['user', 'pass']]);
echo $res->getStatusCode(); // 200
echo $res->getBody(); // { "type": "User", ....
1
composer require guzzlehttp/guzzle
0
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);

}
0

New to Communities?

Join the community