I'm trying to implement SkyScanner API...
I need to call:
"http://partners.api.skyscanner.net/apiservices/pricing/uk1/v1.0/
{SessionKey}?apiKey={apiKey}
&pageIndex=0
&pageSize=10"
so I write:
$res1 = $client1->get('http://partners.api.skyscanner.net/apiservices/pricing/uk2/v1.0/'.$session_id.'?apikey=APIKEY&pageIndex=0&pageSize=10"');
$res1 = json_decode($res1->getBody()->getContents(), true);
$res1 = collect($res1);
and I need to wait for a response to change Status from UpdatePending to UpdateCompleted
API docs:
Keep requesting page 0 until you get UpdatesComplete with pageIndex=0 at half a second to one second interval. Once you get UpdatesComplete you may request any page and page size.
While the status is UPDATESPENDING, you should request only page 0 because the contents of each page are liable to change until updates are complete.
How to wait for response to change status...
I try:
while ($res1['Status'] == 'UpdatesPending') {
echo 'waiting';
}
dd($res1);
but there is no end ...
How to wait for a response to change status?
you can echo
'waiting'before youre code then it is be compleate echocompletedin the other line