There is a small demand program that only needs to send a request. others do not need to receive the returned information. there is a small demand program that only needs to send a request. others do not, no need to receive returned information
Reply content:
There is a small demand program that only needs to send a request. other programs do not need to receive the returned information.
Use cURL
CURL can POST some parameters to the specified path. for specific instances, you can use the PHP cURL function.
File_get_contents ('http: // baidu.com ') is the easiest way to use file_get_contents ('http: // baidu.com ').
In fact, you want to: when sending a request, do not block your current process
Start with your Baidu PHP asynchronous task
Common solutions include Redis publish/subscribe, Gearmand, etc.
My own business is complicated. PHP uses socket and Nodejs for high-speed communication (telling nodejs what task to execute), and Nodejs communicates with RabbitMQ as the consumer, so I cannot tell you clearly.
The principle is that PHP is not responsible for initiating Http requests. it is only responsible for notifying what to do and allowing a special program to execute request tasks.
Do_something (); // inform the background to execute the request task, immediately execute next (); do_backend ("send_request", "http://www.baidu.com "); // perform other operations next ();
Worker (task execution end, which can be a php program or a program in other languages)
// Subscribe ("send_request", function ($ url) {file_get_contents ($ url); // or curl });