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

kasimir-k kasimir.k.lists at gmail.com
Mon Mar 12 07:18:44 CDT 2007

Dave Stevens scribeva in 12/03/2007 11:58:
> The way it's done where I've been working, in PHP, is:
> $hitURL = "http://www.whatever.com/file.php?a=1&b=2";
> $f = file($hitURL);
> Should anyone respond with reasons why this method is a bad approach, 
> I'll happily hear their comments!

Not bad, but often file_get_contents is better - from 
"file_get_contents() is the preferred way to read the contents of a file 
into a string. It will use memory mapping techniques if supported by 
your OS to enhance performance."

file_get_contents() returns the content in a string, file() in an array.


More information about the thelist mailing list