I am Trying to call data from API which working fine in Postman and jquery , it has a API key name "APP_KEY" which must be sent as a header or else the data of the API can not be accessed ,I am trying to get the data using Guzzle HTTP Client But it is not sending the header,
Here is the Header that needs to be passed in:
APP_KEY=>QAWLhIK2p5
Here is the Controller Part:
$client = new Client();
$body['headers']= array('APP_KEY'=>'QAWLhIK2p5');
$response = $client->GET('http://localhost:1080/busy/public/api/material',$body);
//dd($response->getStatusCode());
print_r($data = $response->getResponse()->getContents());
Just tell me please how can I send the header with the Link to API
Any Help would be highly appreciated
api_key
is send asbody
or insideauthorization
header. Also whichapi
you are trying to consume(any third party service). – Dark Knight