Php sends requests only, no matter how the reply request is written

Source: Internet
Author: User
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 });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.