Alan McKay wrote:

> Folks,
>
> I'm new to PHP and am looking for a function that
> will allow me to pass it a URL, and it will return
> a string which is the HTML code found at the given URL.
> I want to write some plugins for Geeklog which will
> harvest stock data from financial websites.
>
> thanks,
> -alan
>
Hey,

i think this might work for you:

<untested beta code here, might crash>

function get_file($url)
{
    return implode('', file($url));
}

input: an url with http:// before it or ftp://
output: the contents of the given url as one big string.

One small warning though: be sure the other side and your side are fast: 
sometimes it can take
a few seconds (minutes) for the file to be loaded, depending on the 
speed of your machine and
the machine the file is hosted on, and if the machine is reachable.

Have fun with it ;)

JF Bethlehem



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to