0

For some reason, some times with cURL find the pages but not other times, instead simple_html_dom find the page with same url.

For example:

$url = http://www.youtube.com/results?search_type=search_users&search_query=java&page=7

with cURL the page is not foud:

$curl = curl_init();
curl_setopt($curl, CURLOPT_REFERER, $url); 
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec( $curl );
curl_close($curl);

if(strpos($content, "404") || $content==""){ echo "**************** PAGE NOT FOUND ****************\n"; return;}

but yes with html_simple_dom:

$content = file_get_html($url);//same url above 
Donovant
  • 3,091
  • 8
  • 40
  • 68

0 Answers0