For some reason the code below when I iterate through some urls, curl_exec never returns anything. I've verified the urls it is getting are correct. I've manually checked them to see if there is output. I've tried removing CURLOPT_RETURNTRANSFER, and curl_exec would return true. I'm not sure why curl_exec isn't returning the data that I need.
function _curl_get($urls)
{
$html_str = '';
foreach ($urls as $url)
{
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$html_str .= curl_exec($curl_handle);
curl_close($curl_handle);
}
return $html_str;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…