PHP: How to return information to a waiting script and continue processing

后端 未结 7 2038
暖寄归人
暖寄归人 2021-02-09 22:14

Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider and makes an http request to it (Provider.php?data=\"data\"). In th

7条回答
  •  北荒
    北荒 (楼主)
    2021-02-09 22:55

    I think you'll need on the provider to send the data (be sure to flush), and then on the Requester, use fopen/fread to read an expected amount of data, so you can drop the connection to the Provider and continue. If you don't specify an amount of data to expect, I would think the requester would sit there waiting for the Provider to close the connection, which probably doesn't happen until the end of it's run (ie. all the secondary work intensive tasks are complete). You'll need to try out a few POC's..

    Good luck.

提交回复
热议问题