hi , I,m trying to pars some information form a webpage , but I got strange results. $regexxp = "/\<TR CLASS=oddrow><TD ALIGN=CENTER CLASS=grid><\/TD><TD CLASS=grid>(.*?)<\/TD><TD CLASS=grid>(.*?)<\/TD><TD CLASS=grid><IMG SRC=\/images\/.*.gif>(.*)<\/TD><TD><NOBR><A HREF='..\/teams\/.*.html' CLASS=grid>(.*?)<\/A><\/NOBR><\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid>(.*?)<\/TD><TD ALIGN=RIGHT CLASS=grid><STRONG>(.*?)<\/STRONG><\/TD><\/TR>/i"; $filename = 'debug.txt'; $debfile = fopen($filename,"w"); $webpage = file_get_contents ("http://itv.stats.football365.com/dom/ENG/PR/overview.html"); $webpage = ereg_replace("<!-- OverviewTable -->","",$webpage); $webpage = ereg_replace("even","odd",$webpage); $webpage = ereg_replace("prom","grid",$webpage); $webpage = ereg_replace("rel","grid",$webpage); $webpage = ereg_replace("<TD><IMGl","<TD CLASS=grid><IMG",$webpage); $webpage = ereg_replace("gif></TD>","gif>=</TD>",$webpage); $matches = preg_match_all($regexxp,$webpage,$tablefix); for ($i=0; $i<count($tablefix[0]); $i++) { print $tablefix[0][$i]."-"; echo "<br>"; } fwrite($debfile,$webpage); PHP: The result is very bad 594Everton8413108213- 6115Portsmouth83321512312- 7103Blackburn Rovers733175212- 862Chelsea833278-112- 954Newcastle United632195411- 1082Aston Villa631274310- 1174West Ham United731397210- 13141Birmingham City8224710-38- 14151Sunderland8224813-58- 15132Middlesbrough92251016-68- 16171Fulham81431214-27- 17161Reading8215918-97- Code (markup): it doesnt make sense Anyway , I will really appreciate is someone can help me on this one. Take care
I haven't looked closely at your code, but whenever I do something similar to what you do, I chop it into smaller pieces. If you explode the html into bites that only holds one record, its much easier to handle in a regexp.
I can't really help but you might wanna check out this: http://uk2.php.net/manual/en/ref.curl.php#75126