Maison >développement back-end >tutoriel php > php fsockopen 并发,该怎么解决
php fsockopen 并发
求教 fsockopen 并发。
我想发邮件 不知道 fsockopen 这个怎么并发邮件
if (isset($_GET['act']) && $_GET['act'] == 'sendMail') {<br /> sendEmail();// 发送邮件操作<br /> }<br /> <br /> function fSockGet($url, $timeout = 3)<br /> {<br /> $info = parse_url($url);<br /> extract($info);<br /> $query = isset($query) ? trim($query) : '';<br /> $path = isset($path) ? trim($path) : '';<br /> <br /> $fp = fsockopen($host, 80, $errno, $errstr, $timeout);<br /> if (!$fp) {<br /> exit("$errstr ($errno)<br>\n");<br /> }<br /> <br /> $write = fwrite($fp, "GET {$path}?{$query} HTTP/1.0\r\nHost: {$host}\r\n\r\n");<br /> <br /> // while (!feof($fp)) {<br /> // echo fread($fp, 4096);<br /> // }<br /> }<br /> <br /> <br /> $url = "http://mydir.com/index.php?act=sendMail";<br /> $emailList = array(...);<br /> foreach ($emailList as $email) {<br /> fSockGet($url);<br /> }