|
Posted by Jerry Stuckle on 09/12/07 12:29
mmarlow@gmail.com wrote:
> Hi all,
> I'm trying to get the contents of a file from a URL using
> file_get_contents() or file(). It doesn't work, it eventually just
> times out. It used to display a 'failed to open file' message but now
> returns nothing at all.
>
> - it works with any site that's not on our server, eg: google.com
> - allow_url_fopen is ON (proven with the above test)
> - we have two load balanced servers with identical settings, could
> this be an issue?
>
> Thanks,
> Mat Marlow
>
Mat,
First of all, if it used to display a message but doesn't now, something
has changed. Check phpinfo() to ensure there wasn't an inadvertent
change, i.e. due to an upgrade of PHP, someone else changing the php.ini
file, etc.
If phpinfo() looks good, go to a command line and try to access the page
with telnet, i.e.
telnet example.com 80
GET /
(press enter again)
See if you get the page back. If so, the problem is in your PHP code.
If you don't, the problem is not in your php code, but your site or the
remote. It could be, for instance, the site has changed to require an
HTTP version, i.e.
GET / HTTP/1.1
And I'm not sure file() or file_get_contents() will send such a header.
I never traced it. But if that is the case, you may have to use CURL
to get the page.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|