Setting the http referer with PHP CURL – webscrapping

This is how we simply trick the server with a fake referer!
On webscrapping we can try to hide or make them think that we aren’t performing webscrapping on them!

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.webscrappingthis.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.linkedfrom.com/');
$html = curl_exec($ch);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.