phpbrowscap icon indicating copy to clipboard operation
phpbrowscap copied to clipboard

getting a 403 from browscap.org

Open nicekiwi opened this issue 10 years ago • 6 comments

file_get_contents(http://browscap.org/stream?q=Full_PHP_BrowsCapINI): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden

Can still grab it in my browser, so it looks like they've blocked remote download/scraping.

nicekiwi avatar Jul 07 '14 11:07 nicekiwi

What is the User-Agent string you are sending from your PHP instance? You should consider adding a reasonable value like "My Browser Capabilities Scraper v1.0" in case you didn't set any.

ini_set('user_agent', $myUserAgentString) should do the trick.

Another possibility could be that repetitive download attempts have got you (temporarily) banned from browscap.org.

Funzinator avatar Aug 04 '14 14:08 Funzinator

Uhhh User-Agent string?

I'm calling: $browser = BrowserDetect::getInfo();

This worked for half a year with no issues, So I doubt its a ban.

Preforms a wGet from the server terminal

Ok, it seems I am banned.. 0_o;; phpbrowsecap caches the file though right? Why would it have been downloading so many times?

nicekiwi avatar Aug 04 '14 20:08 nicekiwi

That's not what I meant. In the source of your original question, you state that you use file_get_contents(...). I meant the User-Agent PHP sends to the web server at browscap.org. This is controlled by the ini setting.

Seems pretty much that you have been banned. The rules for the download are very strict. Calling the version URL is not restricted, but calling the URL you mention above is. As stated on browscap.org, you have to contact the browscap people via the Discussion Forum to get yourself unbanned.

Anyway, the browscap.ini is cached and you can download the ini manually from a non-blocked machine and copy it over.

Funzinator avatar Aug 05 '14 22:08 Funzinator

No, I'm not calling file_get_contents() directly, that's the trace error I got in the Laravel PHP debugger.

nicekiwi avatar Aug 06 '14 02:08 nicekiwi

You have to admit that I can't know that if I read your initial issue description... Anyway, seems you are banned because stream?q=Full_PHP_BrowsCapINI has been downloaded too frequently. Any luck on the Discussion Forum?

Funzinator avatar Aug 06 '14 08:08 Funzinator

Have this issue been fixed in ver. 2.0?

korys avatar May 18 '17 06:05 korys