开发者

Push update notifications back to PHP while calling a function

开发者 https://www.devze.com 2023-04-01 18:09 出处:网络
I have a PHP script that loads a function which uses Curl to log itself in to another webpage to get some data. This operation takes about 14 seconds altogether and some users might become impatient.

I have a PHP script that loads a function which uses Curl to log itself in to another webpage to get some data. This operation takes about 14 seconds altogether and some users might become impatient. I have a little busy loader to indicate activity.

I have seen this on other websites and want to know what technology I need to implement the following:

How can I send little notification messages back to the main site while the PHP function is running so the user knows about the progress.

Messages could be in the开发者_开发技巧 following form:

Logging in to website
Extracting data
Sorting data
Closing connection


You can do it using ajax, do the following.
1) Keep your curl code in the seperate php file.
2) While click the button, using js or jquery call that php file using ajax.
3) Before ajax return the reponse, you can display the div with your message, once you
got response, you can hide the div.
0

精彩评论

暂无评论...
验证码 换一张
取 消