PHP file_get_contents() behaves differently to browser.
Posted
by DaveG
on Stack Overflow
See other posts from Stack Overflow
or by DaveG
Published on 2010-03-30T20:26:37Z
Indexed on
2010/03/30
20:33 UTC
Read the original article
Hit count: 224
php
|file-get-contents
I'm trying to download the contents of a web page using PHP. When I issue the command:
$f = file_get_contents("http://mobile.mybustracker.co.uk/mobile.php?searchMode=2");
It returns a page that reports that the server is down. Yet when I paste the same URL into my browser I get the expected page.
Does anyone have any idea what's causing this? Does file_get_contents transmit any headers that differentiate it from a browser request?
© Stack Overflow or respective owner