Search code examples
laravelguzzle

Laravel guzzleHttp error 302 and return null value


I'm creating a Laravel project that getting data from API using guzzleHttp request. But getting error 302. I've tried using options 'allow_redirects'=>false but still not working. here piece of my code, hope you guys understand what my problem is and sorry for my bad english.

$list_receiveItem = Http::withHeaders([
        'Authorization' => 'Bearer '.$data['access_token'],
        'X-Session-ID' => $xsessionID,
        'Accept' => 'application/json'
    ])->withOptions([
        'allow_redirects' => false  
    ])->get($host.'/api/item/list.do',[
        'query_param' => [
            'fields' => 'id,name,no',
            'filter.itemType' => 'INVENTORY'
        ]
    ]);  

here's the result when I dd the $list_receiveItem : error

edited : here's the error I got from postman : Error From Postman


Solution

  • unfortunely, I send a wrong URL in http get, so that's why I'm getting this error.

    I've solved this issue.

    Thank you so much.