Re: [PHP] Parsing HTML files
On Fri, 10 Sep 2004 11:58:58 +0100, in php.general [EMAIL PROTECTED] (Abdul-Wahid Paterson) wrote: >> I was wondering if any classes/functions could help me with this little >> challenge, (im hopeless at regex ;-) >> >> > >No easy way of doing it, regex somthing like: > >$id = preg_replace("/.*/", $1, $string); How about just using an xml-based function? Much cleaner, doesn't require name-attribute to be present before value-attribute. '; $x = xml_parser_create(); xml_parse_into_struct($x,$string,$array); print $array[0]['attributes']['VALUE']; // or, out of curiousity: var_dump($array); ?> (and why preg_replace? $1 wouldn't even be set since no capturing parenthesises are used) -- - Peter Brodersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTML files
* and then Abdul-Wahid Paterson declared > No easy way of doing it, regex somthing like: > > $id = preg_replace("/.*/", $1, $string); > > where $string is a line from your input'd HTML page OK, thanks abdul, much appreciated.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTML files
No easy way of doing it, regex somthing like: $id = preg_replace("/.*/", $1, $string); where $string is a line from your input'd HTML page Abdul-Wahid On Fri, 10 Sep 2004 12:54:37 +0200, Nick Wilson <[EMAIL PROTECTED]> wrote: > Hi all, > > I was wondering if any classes/functions could help me with this little > challenge, (im hopeless at regex ;-) > > > > I want to extract the value of 'id' from a webpage. Any simple way to do > this or am I down to sweating of the regex functions? > > Much thanks > -- > Nick W > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing HTML files
Hi all, I was wondering if any classes/functions could help me with this little challenge, (im hopeless at regex ;-) I want to extract the value of 'id' from a webpage. Any simple way to do this or am I down to sweating of the regex functions? Much thanks -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTML files?
For parsing, your best bet would be regular expressions. If you aren't familiar with them, then this would most likely be a custom programming job, as there's no such thing as an off the shelf parsing routine. www.php.net/preg_match_all would be the best function to use to parse, and you should get the input via either www.php.net/fopen or www.php.net/file /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown Networks - More Than White Hats Web Application Security - www.whitecrown.net */ - Original Message - From: Jeff Lewis <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, July 07, 2001 2:18 PM Subject: [PHP] Parsing HTML files? | Is it possible to parse an HTML like at: | http://hyrum.net/wwbl/HTML/watrost.htm ? | | I'd like to be able to grab the player name and ratings and add them to a | "pretty" HTML output :) | | Jeff | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Parsing HTML files?
Yeah it is doable, just use fsockopen, and parse the input into your database and go wild. Keep in mind - doing it directly on request is VERY slow. You should be pre-parsing it and then showing the data from your resources. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 3:19 AM To: [EMAIL PROTECTED] Subject: [PHP] Parsing HTML files? Is it possible to parse an HTML like at: http://hyrum.net/wwbl/HTML/watrost.htm ? I'd like to be able to grab the player name and ratings and add them to a "pretty" HTML output :) Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Parsing HTML files?
Is it possible to parse an HTML like at: http://hyrum.net/wwbl/HTML/watrost.htm ? I'd like to be able to grab the player name and ratings and add them to a "pretty" HTML output :) Jeff
[PHP] Parsing HTML files from an external web server
Hello List. I'm having a little trouble with parsing HTML files and inputting the data from the HTML file into a MySQL database. I get the following error when trying toparse the file. Warning: file("http://www.server.com/file.htm";) - No error in d:\webpages\world\lists.php on line 8 The following is part of my php code http://www.server.com/file.htm";; $fileArray = file($url); $state = 0; $line = 0; $ProvinceCount = 0; $Details = Array(); I then have more code which parses the file and parses the data and puts it in an array. I was wondering whether anybody could provide information as to what the possible problem could be. If you want more information, please contact me off-list. Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Parsing HTML files from an external web server
Hello List. I'm having a little trouble with parsing HTML files and inputting the data from the HTML file into a MySQL database. I get the following error when trying toparse the file. Warning: file("http://www.server.com/file.htm";) - No error in d:\webpages\world\lists.php on line 8 The following is part of my php code http://www.server.com/file.htm";; $fileArray = file($url); $state = 0; $line = 0; $ProvinceCount = 0; $Details = Array(); I then have more code which parses the file and parses the data and puts it in an array. I was wondering whether anybody could provide information as to what the possible problem could be. If you want more information, please contact me off-list. Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]