PHP only sends requests, regardless of how the reply request should be written

Source: Internet
Author: User
There is a small demand program that only needs to send the request, the other, no need to receive return information

Reply content:

There is a small demand program that only needs to send the request, the other, no need to receive return information

Use Curl.
Curl can post some parameters to the specified path, the concrete instance, can parameter Php curl function

With file_get_contents (' http://baidu.com ') The simplest, more complex can be used with curl or fsockopen

In fact, you want the demand is: Send the request, do not block your current process

You Baidu php asynchronous task start
Common solutions include Redis publish/subscribe, Gearmand, etc.

My own more complex, PHP with sockets and Nodejs for high-speed communication (tell Nodejs to perform what task), Nodejs again as consumer and RABBITMQ communication, so you also say not clear.

The principle is that the current PHP is not responsible for initiating HTTP requests, is only responsible for notifying what to do, let a special program to perform the request task

do_something();// 告知后台执行请求任务, 几乎不占用时间就立马执行 next();do_backend("send_request", "http://www.baidu.com"); // 接着做其它东西next();

Worker side (task execution side, can be PHP program, or other language program)

// 异步监听任务subscribe("send_request", function($url){    file_get_contents($url); // 或 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.