[thelist] [PHP] Hitting a URL from within a function, but NOT directing the browser there...

Max Schwanekamp lists at neptunewebworks.com
Mon Mar 12 12:36:01 CDT 2007

kasimir-k wrote:
> Dave Stevens scribeva in 12/03/2007 11:58:
>> $hitURL = "http://www.whatever.com/file.php?a=1&b=2";
>> $f = file($hitURL);
> Not bad, but often file_get_contents is better - from 

FWIW, if the allow_url_fopen php.ini setting is set to false, you might 
use cURL instead (if libcurl is installed, of course).  This has the 
added benefit of some added flexibility in structuring the request. 
E.g. your external resource might use some sort of authentication, which 
curl can negotiate.


Max Schwanekamp

More information about the thelist mailing list