phpbrowscap
phpbrowscap copied to clipboard
getting a 403 from browscap.org
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.
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.
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?
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.
No, I'm not calling file_get_contents() directly, that's the trace error I got in the Laravel PHP debugger.
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?
Have this issue been fixed in ver. 2.0?