note 58337 rejected from ref.curl by jome
| From: | jome@php.net | Date: | Tue, 01 Nov 2005 06:27:49 +0000 |
| Subject: | note 58337 rejected from ref.curl by jome | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97904@lists.php.net to get a copy of this message | ||
Note Submitter: tanengsing at gmail dot com
----
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;
}
}