I'm struggling to change the code from PHP-Guzzle format that i get from postman to Laravel-Guzzle format.
So i want to use this PHP - Guzzle from Postman.
$client = new Client();
$headers = [
'Authorization' => 'OAuth realm="xxx",oauth_consumer_key="xxx",oauth_token="xxx",oauth_signature_method="HMAC-SHA256",oauth_timestamp="123",oauth_nonce="xxx",oauth_version="1.0",oauth_signature="xxx"',
'Cookie' => 'NS_ROUTING_VERSION=LAGGING'
];
$request = new Request('GET', 'https://domainname.com/record/1234', $headers);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
from above code. i need to convert to laravel format. and here is what i've done
use GuzzleHttp\Client;
$guzzle = new Client;
$header = [
'Authorization' => 'OAuth realm="xxx",oauth_consumer_key="xxx",oauth_token="xxx",oauth_signature_method="HMAC-SHA256",oauth_timestamp="123",oauth_nonce="xxx", oauth_version="1.0", oauth_signature="xxx"',
'Cookie' => 'NS_ROUTING_VERSION=LAGGING'
];
$response = $guzzle->request('GET', 'https://domainname.com/record/1234', $header);
dd($response->getBody());
but i got error
Client error: `GET https://domainname.com/record/1234` resulted in a `401 Unauthorized` response: {"type":"https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2","title":"Unauthorized","status":401,"o:error (truncated...)
i tried to solve it but cannot. please help how to make it work on laravel.