mardi 28 août 2018

How to use Guzzle with pagination

I use Guzzle to retrieve API from server API url and i want to fetch the data and using pagination. I try these:

$request_url="http://192.168.0.1:8081/APIServer/public/api/products";
        $client = new \GuzzleHttp\Client();
        $response = $client->request('GET', $request_url, [
            'headers' => ['Accept' => 'application/xml',
                          'Authorization' => 'Bearer ' . $token,
                          'Content-Type' => 'application/json'
                         ],
            'timeout' => 120
        ])->getBody()->getContents();

        $responseXml = simplexml_load_string($response);
        $responseArray = json_decode(json_encode($responseXml), true);

        return view('dashboard')->with(array('data'=>$responseArray['stdClass']));

How can i use pagination with guzzle?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire