note 115748 added to function.curl-multi-exec
| From: | qdujunjie at 126 dot com | Date: | Wed, 17 Sep 2014 14:22:56 +0000 |
| Subject: | note 115748 added to function.curl-multi-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-200463@lists.php.net to get a copy of this message | ||
å½å¨OS X mavericksä¸è¿è¡curl_multi_exec()æ¶ï¼
å¯è½ä¼å¾ä¸å°æ³è¦çç»æï¼
å ä¸ºèæ¬ä¼ä¸ç´æ§è¡ä½æ¯å´æ²¡æè¿åå¼ï¼
è¿æ¯å 为å¨OS Xä¸å½phpå¨5.3.8以ä¸çæ¬æ¶ï¼
å¨è°ç¨curl_multi_exec()æ¹æ³ä¹åcurl_multi_select()ä¼ä¸ç´è¿å-1ï¼
æä»¥è¿éæ¹åä¸ä¸èæ¬ï¼
å¯ä»¥å¨OS X䏿忧è¡ï¼
<?php
$ch1 = curl_init();
$ch2 = curl_init();
// 设置URLåç¸åºçé项
curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net");
curl_setopt($ch2, CURLOPT_HEADER, 0);
// å建æ¹å¤çcURL奿
$mh = curl_multi_init();
// å¢å 2ä¸ªå¥æ
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
$active = null;
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK)
{
// add this line
while (curl_multi_exec($mh, $active) === CURLM_CALL_MULTI_PERFORM);
if (curl_multi_select($mh) != -1)
{
do {
$mrc = curl_multi_exec($mh, $active);
if ($mrc == CURLM_OK)
{
while($info = curl_multi_info_read($mh))
{
var_dump($info);
}
}
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
----
Server IP: 72.52.91.14
Probable Submitter: 180.159.77.5
----
Manual Page -- http://php.net/manual/en/function.curl-multi-exec.php
Edit -- https://master.php.net/note/edit/115748
Del: integrated -- https://master.php.net/note/delete/115748/integrated
Del: useless -- https://master.php.net/note/delete/115748/useless
Del: bad code -- https://master.php.net/note/delete/115748/bad+code
Del: spam -- https://master.php.net/note/delete/115748/spam
Del: non-english -- https://master.php.net/note/delete/115748/non-english
Del: in docs -- https://master.php.net/note/delete/115748/in+docs
Del: other reasons-- https://master.php.net/note/delete/115748
Reject -- https://master.php.net/note/reject/115748
Search -- https://master.php.net/manage/user-notes.php