My PHP code
$urlArray = array('http://firsturl.com', 'http://secondurl.com');
$nodeCount = count($urlArray);
$chContainter = array();
$mh = curl_multi_init();
for($i = 0; $i < $nodeCount; $i++) {
$chContainter[$i] = curl_init();
curl_setopt($chContainter[$i], CURLOPT_URL, $urlArray[$i]);
curl_setopt($chContainter[$i], CURLOPT_HEADER, 0);
curl_setopt($chContainter[$i], CURLOPT_RETURNTRANSFER,1);
curl_multi_add_handle($mh,$chContainter[$i]);
}
is generating the following warning
Warning: (null)(): 4 is not a valid cURL handle resource in Unknown on line 0
Warning: (null)(): 5 is not a valid cURL handle resource in Unknown on line 0
I did some debugging and found out the warning was generated when I try to add curl handle to the $mh.
Please help. Thanks.
Make sure to initialize curl_multi_init()
only after you initialized your curl_init()
sessions, otherwise you'll get that error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With