Page 1 of 1

Capturing the text of a web page and putting it in a string

Posted: Tue Jul 06, 2004 5:26 am
by Paddy
Ok, I am not even sure if this can be done but I would be happy if it could.

I need a function so I can grab the text of a given URL so that I can manipulate it. Ideally I would like it to be placed in a string. So...

$somestring = somefunc("http://www.someurl.com");

Any ideas?

Posted: Tue Jul 06, 2004 5:29 am
by markl999

Code: Select all

$somestring = file_get_contents('http://www.someurl.com');
(also see http://php.net/file if you want each line of the remote site as an element of an array)

Posted: Tue Jul 06, 2004 7:31 am
by Paddy
Which is pretty much why I absolutely love this site. :)

Thanks heaps Mark. :)

Posted: Tue Jul 06, 2004 9:58 am
by feyd
if you don't have URL wrappers on, for whatever reason. You will need something like [php_man]curl[/php_man]