RE: [PHP] Extracting Data from a URL output

From: Date: Thu, 18 Jan 2001 02:02:19 +0000
Subject: RE: [PHP] Extracting Data from a URL output
Groups: php.general 
Request: Send a blank email to php-general+get-35230@lists.php.net to get a copy of this message
// get a web page into an array and remove html // file() returns an array, which you can then loop through $fcontents = file ('http://www.php.net'); while (list ($line_num, $line) = each ($fcontents)) { // if preg_match the weather text you are looking for // preg_replace any html markup with empty string here } http://www.php.net/manual/en/function.file.php http://www.php.net/manual/en/function.preg-replace.php -Ben -----Original Message----- From: Chris Aitken [mailto:chris@ideal.net.au] Sent: Wednesday, January 17, 2001 2:51 PM To: php-general@lists.php.net Subject: [PHP] Extracting Data from a URL output I have a bit of a question which ive tried to look into, but I cant seem to find the right commands to check into or what the best method of attack it. Basically, I want to grab a URLs data, make the data a string (which im doing with fopen and fread). But now I have the entire html as a string, Im confused as to how I best attack stripping just the data I need out of it. There is alot of stuff at the top of this particular page before the actual content starts. Is there anyone who has some examples of how they have attacked this type of task, or even just point me in the direction of how to start ? I have tried to utilise strstr() but because there is no real comon thread starting off the data I need, I cant really use it properly. There is always a common word in the data (its a local weather output). For example, today it was - ...size=4 color=white>Todays weather will be 28 degrees in Sydney</font>...... with a whole bunch of other site crap up the top. What im trying to do is simple extract everything between the > and the < wherever the word weather appears (its the common word) and its totally baffling me. Any help would be great. Chers Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#35230) next »