Changing user-agent in DOM

Asked by At

Hi i am trying to scrape some data on amazon but i always get blank result, i tried to change my useragent but it still does not work, please can someone look at what is wrong

<?php

require_once "core.php"; 

include "simple_html_dom.php";


$_curl = curl_init();
curl_setopt($_curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($_curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($_curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($_curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
curl_setopt($_curl, CURLOPT_URL, 'https://www.amazon.com/Apple-iPhone-Plus-Unlocked-32GB/dp/B01N6ZAR0D/');
$html = curl_exec( $_curl );

$_htmlDom = new simple_html_dom();
$_htmlDom->load(  $html  );

echo $html;

}

?>

0 Answers