【发布时间】:2019-02-03 17:18:54
【问题描述】:
我使用 Guzzle 从服务器 API url 检索 API,我想获取数据并使用分页。 我试试这些:
$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']));
如何使用 guzzle 进行分页?
【问题讨论】:
标签: php laravel api laravel-5 guzzle