Jump to content

Php Advice on best approach


oracle765

Recommended Posts

Hi professionals just after some advice on what to do for the best here

 

We have a website that queries Expedia, Laterooms and a few other hotel APIs and displays the hotel results which is fine

 

The problem is it takes a very long time and the user waits and waits and waits for the results to be displayed

 

Is there a way to display some results asap to the user whilst the APIs are still querying and then the rest of the results once finished

 

Or a way to build up the result set bit by bit

 

 

Any advice if this is possible and where to start would be greatly appreciated

 

Thanks in advance

Alan

Link to comment
Share on other sites

The term you're looking for is "asynchronous". You can't delay output with PHP alone. Output is sent once the script is finished. You would need to use Javascript to accomplish this.

 

There are a number of ways to solve this. You could use AJAX with JSONP. Or if the API's allow CORS, you can just use straight up AJAX. Or, you could have a PHP script run in the background and then use AJAX to call that script.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.