RE: [PHP] Parsing an HTML page using PHP

From: Date: Mon, 05 Nov 2001 15:30:35 +0000
Subject: RE: [PHP] Parsing an HTML page using PHP
Groups: php.general 
Request: Send a blank email to php-general+get-73496@lists.php.net to get a copy of this message
tons of tutorals like this at zend.com and phpbuilder but the basics are: $file="http://www.othersite.com/news.htm"; $fd = fopen ($file, "r"); $start = fread ($fd, filesize ($file)); fclose($fd); //find a unique identifier in the HTML source ie: "<!--news starts here -->" $trimmed= explode("'<!--news starts here -->'", $start); //same for the end of interesting source ie: "<!--news ends here -->" $trimmed2= explode("'<!--news ends here -->'", $trimmed); //split on identifier for each news item" $list= split("'<UL><LI>'", $trimmed2[0]); foreach ($list as $cfile){ echo "<UL class=myclass><LI class=myclass>$cfile"; } ____________________________ Matthew Luchak Webmaster Kaydara Inc. mluchak@kaydara.com -----Original Message----- From: Sheni R. Meledath [mailto:sheni@cyber-gear.com] Sent: Monday, November 05, 2001 10:18 AM To: PHP Masters Subject: [PHP] Parsing an HTML page using PHP Hello: Can anybody suggest me a logic to develop a PHP script to parse an html page on another site to extract the news and display it on my site. Details: http://www.othersite.com/news.htm This page has got some news items. All news titles are listed using bullet points (<UL><LI><A HREF="newslink1.htm">News 1</A></LI></UL> I have to extract the news titles and the links from this page and display it on my page. The reason is the news page is frequently updated and instead of updating my page every time, if I write a script then my page also will be automatically updated everytime. Many thanks Sheni R Meledath sheni@cyber-gear.com -- 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 (#73496) next »