文章利用了socket来实现异步调用,有需要学习socket的朋友可以参考一下本文章以及参考资料,代码如下:
- <?php
- $host = "www.phpfensi.com";
- $path = "/Report.php?ReportID=1";
- $cookie = Session_id();
-
- $fp = fsockopen($host, 80, $errno, $errstr, 30);
- if (!$fp) {
- print "$errstr ($errno)<br />n";
- exit;
- }
- $out = "GET ".$path." HTTP/1.1rn";
- $out .= "Host: ".$host."rn";
- $out .= "Connection: Closern";
- $out .= "Cookie: ".$cookie."rnrn";
-
- fwrite($fp, $out);
-
-
-
-
-
- fclose($fp);
- ?>
|