byPAss curl / file_get_contents blocking for scrapping


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $userAgent = 'Googlebot/2.1 (http://www.googlebot.com/bot.html)';
  2. $curl = curl_init($url);
  3. curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
  4. curl_setopt($curl, CURLOPT_AUTOREFERER, true);
  5. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  6. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1 );
  7. curl_setopt($curl, CURLOPT_TIMEOUT, 2 );
  8. $html = curl_exec( $curl );
  9. curl_close( $curl);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.