PHP Curl async response

前端 未结 2 889
小蘑菇
小蘑菇 2021-02-11 00:56

I have a PHP file that invokes another PHP file via curl. I am trying to have the second file send a response back to the first to let it know that it started. The problem is th

相关标签:
2条回答
  • 2021-02-11 01:35

    This could be just what you're looking for. Forking in PHP:

    http://framework.zend.com/manual/en/zendx.console.process.unix.overview.html

    A process divides in two. One is father of the other. The father can tell the client he just begun and the child can do the job. When the child finishes, he's able to report the father which can also report to the client.

    Keep in mind there are many requirements for this to run:

    • Linux
    • CLI or CGI interface
    • shmop, pcntl and posix extensions (require recompiling)
    0 讨论(0)
  • 2021-02-11 01:52

    The answer ended up being that CURL does not behave like a browser:

    PHP Curl output buffer not receiving response

    I ended up running my 2nd file first and my 1st file second. The 2nd file waited for a 'finished' file write that the 1st file did once it, obviously, finished.

    At this point, it seems like the database would be a better place to store messages for files to be able to pass between each other, but a file would also work for a quick and dirty job.

    0 讨论(0)
提交回复
热议问题