Hello
I have programmed a script to scrape some data from a huge website.
It something like this:
It worked great, but the website owner found out I was scraping it and he has build in some security.
When the script visits a page of their website, the referrer is blank because php is visiting it directly. When they are getting too much blank referrer from the same IP, they're blocking the IP.
So now I need to find a way to fake the referrer with my PHP script. I've already tried it with some Chrome addons. It does work when I visit it by hand but not when I let the PHP script do it's job.
I think I have to fake the referrer just before it does this:
$html = file_get_html($url);
Because that's the line where the PHP script is actually going to the website to gather the content.
I hope someone can help with this.
Edit: Forgot to mention, the file_get_html function is a function of "simplehtmldom" (google it because I cannot post URL's)
I have programmed a script to scrape some data from a huge website.
It something like this:
PHP:
<?php
$url_list = "urls.txt";
foreach (file($url_list) as $url) {
$html = file_get_html($url);
Here all the scraping stuff.
}
?>
It worked great, but the website owner found out I was scraping it and he has build in some security.
When the script visits a page of their website, the referrer is blank because php is visiting it directly. When they are getting too much blank referrer from the same IP, they're blocking the IP.
So now I need to find a way to fake the referrer with my PHP script. I've already tried it with some Chrome addons. It does work when I visit it by hand but not when I let the PHP script do it's job.
I think I have to fake the referrer just before it does this:
$html = file_get_html($url);
Because that's the line where the PHP script is actually going to the website to gather the content.
I hope someone can help with this.
Edit: Forgot to mention, the file_get_html function is a function of "simplehtmldom" (google it because I cannot post URL's)
Last edited: