note 58337 added to ref.curl
| From: | tanengsing at gmail dot com | Date: | Tue, 01 Nov 2005 06:22:42 +0000 |
| Subject: | note 58337 added to ref.curl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97903@lists.php.net to get a copy of this message | ||
Hi! cURL is great (really!!) for doing datamining. But I'm facing some problems with
curl_multi_getcontent() though. I've created a class which contains an array of curl handles
and a curl multi handle.
After initializing all the variables, the results returned are correct BUT I've got a warning
from php saying that curl_multi_getcontent() expects a resource... that's abit weird coz'
I've debugged and confirmed that I've passed in a resource - i.e. a curl_handle - into
this function.
Anyone facing similar problem? Or am I doing the wrong thing?
Here's a fraction of how my codes looks like:
class MultiMine {
var $curl_handles=array();
var $curl_multi_handle=curl_multi_init();
var $curl_results=array();
..........
function initialize_curl_handles(...) {
for ($i=0; $i<10; $i++) {
$this->curl_handles[$i] = curl_init($url...);
curl_setopt($this->curl_handles[$i], ....);
......
curl_multi_add_handle($this->curl_multi_handle, $this->curl_handles[$i]);
}
}
function start(...) {
// perform curl_multi_exec until all done
}
function getresult(...) {
for ($i=0; $i<10; $i++) {
$this->curl_results[$i] = curl_multi_getcontent($this->curl_handles[$i]);
}
return $this->curl_results;
}
}
----
Manual Page -- http://www.php.net/manual/en/ref.curl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58337
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58337&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58337&report=yes
Search -- http://master.php.net/manage/user-notes.php