开发者

HTTP POST to PHP: Looking for some basic help

I have a form that sends a simple http post to a PHP page. The PHP code processes the post which results in pulling a JSON stri开发者_C百科ng from a url, parsing it, and then sending a bunch of emails. All the code is on one page and works as intended.

The thing that bugs me is waiting for all the emails to get sent, and finally receiving the HTTP post response. What I'd like to do is separate the initial post from the JSON string processing. In other words, close the post session immediately, getting a simple "Done" and let the PHP JSON-processing code do its thing.

I'm new at PHP so any advice will be helpful.


I would add the mails that have to be sent to a database and setup a cron job to periodically send all mails that have not been sent yet.


You're looking for fsockopen() function


The best option would be to use a message queue like Redis(has blpop/brpop commands) . Luckily redistogo offers free plans. There should be more than enough information on the web about this(Google).

Second best option would be to use asynchronous calls

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜