Page 1 of 1

fetching data from html tables using php

Posted: Tue Mar 28, 2006 4:47 am
by jito
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
can anybody help me to fetch data from a html table to a text file using php.
I have tried that code:

Code: Select all

while ( ! feof( $fpr ) ) 
{
   $str .=fgets( $fpr);

}

$do = preg_match_all("/<td>(.*)<\/td>/", $str, $matches,PREG_PATTERN_ORDER);


foreach($matches as $key=>$val)
{
	
	foreach($val as $v1)
	{
		echo ($v1)."<br>";
		
	}
	
}
but i don't have the desired output. Anything i should modify in regex?


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Mar 28, 2006 9:13 am
by feyd
What's the input loop like? What's the output you'd like to see?

Posted: Tue Mar 28, 2006 10:52 am
by Chris Corbyn
change .* to " .*? " ;)