I need to extract content from a page and i write this code but i dont get all the results.. The results should be 100 and i get only the first result. Can someone help me with this to make it get all the results from each td? $site = file_get_contents("http://site.com/page.html"); $i = 0; while($i <= 100) { $track = explode("<form class='Right' id='frpage1' name='frpage1' method='get' action=''>", $site); $track = explode("<div class='Selection' align='center'>", $track[$i]); $track = $track[0]; $url= explode("<td width=40%>", $track); $url= explode("</td>", $url[1]); $url= $url[0]; $name = explode("<td width=35%>", $track); $name = explode("</td>", $name[1]); $name = $name[0]; ++$i; print $url; } Code (markup):
Hi Oli3l I tryed with preg match_all and it works good i get all the results on "print_r" but the problem is that i need to fetch from a site to my site and when i do that with preg_match_all, on my site appears only "array" in the name field and urls field and i get some errors from base64 url encoding. I'm not good with preg_match at all. and i don\t know how can i make it to show me the simple results without arrays and numbers just results and to be able to see the results with "print $results;" instead of "print_r ($results); if is possible. i don't know. If i had to do it with preg_match i need to do it similar to this one. Can you help me?
well.. you could use implode() to glue together the array cells.. you can also use foreach() to run over all of the array
Ok I have made it like this. I get the results but i need the print to be out of {} to be able to make only one print for $nume, $ur; and to implement in my site