Php cyclically requests multiple URLs to the current network segment (192.168.1.0 ~ 192.168.1.255), request url, and send data.
The url must be executed cyclically. the returned results do not need to be processed, and the returned results are not waiting.
How can this function be implemented ?.
Reply to discussion (solution)
PHP code? 1234567
Thank you for your reply. The socket only opens the link. This url is not executed, right? How can I execute this url?
$ StreamData = "GET {$ url} HTTP/1.0 \ r \ n"; $ streamData. = "Accept: */* \ r \ n"; $ streamData. = "Accept-Language: zh-cn \ r \ n"; $ streamData. = "Host: {$ host} \ r \ n"; $ streamData. = "Connection: Close \ r \ n"; $ streamData. = "Cookie: \ r \ n"; $ ip = ""; $ timeout = 15; $ fp = fsockopen ($ ip? $ Ip: $ host), $ port, $ errno, $ errstr, $ timeout); $ ret = ""; if (! $ Fp) {return '$ errstr: $ errno'; // note $ errstr: $ errno \ r \ n} else {// Set blocking/non-blocking mode stream, $ block = true applies the stream mode stream_set_blocking ($ fp, false); // sets the stream timeout Time // stream_set_timeout ($ fp, $ timeout); fputs ($ fp, $ streamData); // while (! Feof ($ fp) {// $ ret. = fgets ($ fp, 128); //} fclose ($ fp); // echo $ ret ;}
Fopen ("http: // 127.0.0.1: 8182/now/form. php? Id = 5689 "," r ");
File_get_contents ("http: // 127.0.0.1: 8182/now/form. php? (Id = 5689 ");
Run the specified url. both methods run successfully on apache.
Failed in ngiux. Ask Why
Php. ini is required for file functions to act on URLs.
Allow_url_fopen = On
Allow_url_fopen = On // enabled
Test. php
Echo file_get_contents ("http: // localhost: 8182/now/form. php ");
?>
Form. php
Echo "abc ";
?>
-------------------------
The same code is executed differently in apache and nginx.
Run test. php:
Apache output: abc; nginx running error, the page is always refreshed
Php. ini is required for file functions to act on URLs.
The same allow_url_fopen = On code is executed differently in apache and nginx. Thank you.
May be nginx configuration problems? Not clear