curlrequest not updating the headers |
Hi,
It seems that the "curlrequest" is not updating the header when I make 2 API calls right after another. One API call to get the token (with 2 header items) then again call the second API with the Token in the header (3 header items). Second API call keeps failing as the header is not getting updated. To test this I got the Token from the 1st and Hard corded it to the second and disable the 1st call, then it worked. $client = \Config\Services::curlrequest(); $body = '{"username":"[email protected]","password" : "'.$keys->pw.'"}'; /// 1st call $result = $client->setBody($body)->post($keys->url.'/v1/login/', [ 'headers' => [ 'Content-Type' => 'application/json', 'x-api-key' => $keys->key ] ]); $info = json_decode($result->getBody()); ///2nd call $result2 = $client->get($keys->url.'/v1/members/data/'.$member_id, [ 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => 'JWT '.$info->token, 'x-api-key' => $keys->key ], 'debug' => true, 'http_errors' => false ]); Please help! |
Messages In This Thread |
curlrequest not updating the headers - by chakycool - 06-17-2021, 07:35 AM
RE: curlrequest not updating the headers - by chakycool - 06-19-2021, 11:21 PM
RE: curlrequest not updating the headers - by chakycool - 06-20-2021, 01:34 AM
RE: curlrequest not updating the headers - by jreklund - 06-20-2021, 03:49 AM
RE: curlrequest not updating the headers - by paulbalandan - 06-20-2021, 05:16 AM
RE: curlrequest not updating the headers - by chakycool - 06-20-2021, 05:28 AM
|