Unable to CURL a remote file -
I have a piece of code that is designed to get any URL and erase it from the web It's been working so far, unless someone returns this URL:
If I hit it with my browser, it just looks okay. But when I try to curl it down, I get:
& Lt; P & gt; You do not have permission to access /static/images/aspen_hill-rom_logo.png on this server. & Lt; / P & gt; & Lt; Hour & gt; & Lt; Address & gt; Server www.aspensurgical.com Port 80 & lt; / Address & gt; & Lt; / Body & gt; & Lt; / Html & gt; I am using curl code:
$ ch = curl_init (str_replace ('', '% 20', $ url)); $ FH = FOPN ($ local_file, "W"); Curl_setopt ($ CH, CURLOPT_FILE, $ FH); Curl_exec ($ ch); Curl_close ($ ch); Does their server know in some way that I'm not a normal browser and I'm booting?
Check to see who you are, add the usergroup of the normal browser and you're okay needed.
curl_setopt ($ ch, CURLOPT_USERAGENT, "Mozilla / 5.0 (Windows NT 6.1; rv: 19.0) Gecko / 20100101 Firefox / 1 9.0"); Here are examples of working.
Comments
Post a Comment