Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Downloading and parsing web-stuff
- David Rasmussen
April 22, 2005, 6:51 am
rate this thread
What is the easiest way in php to download the source code (HTML etc.)
of a given URL (say, http://www.google.com">http://www.google.com) and parse this code for
I guess my question can be split in two:
1) How do I download a webpage (into a string or whatever)?
2) How can I do string manupulation, regexp matching, information
extraction etc. on the downloaded information?
Re: Downloading and parsing web-stuff
Treat a full URL as a file.
$contents = implode( file("http://www.google.com/"">http://www.google.com/", ''\n") );
Then go to www.php.net/preg_match/ to read up on PCRE (Perl compatible
regular expressions). See also ereg_* functions.
Melt away the Cellulite with Cellulean!