Posts

Showing posts with the label guzzle

How to call dynamic url in Guzzle with GET request

How to call dynamic url in Guzzle with GET request I'm using Laravel and Guzzle and i want to call java spring rest api and get result from dynamic url : http://localhost:8080/api/clients/clientAvailability/{id} .With static url (http://localhost:8080/api/clients/clientAvailability/9976 everything works great but for dynamic i don't know how to solve it. Rest api which i want to call Controller (function for call rest api) $url='http://localhost:8080/api/clients/clientAvailability/9976'; try{ $client = new Client(); $response = $client->request('GET', $url); $body = $response->getBody(); $status = 'true'; $message = 'Data found!'; return view('chart.clientProfile', ['clients' => $body]); // is thrown for 400 level errors }catch(ClientException $ce){ $status = 'false'; $message = $ce->getMessage(); $data = ; //In the event of a networking error (connect...