Im having some difficulties with parsing data from another website. I can get the first peace out of it, but when trying to get out the rest of the pieces from the first cut, things stop working as they did. Heres the code:
$html = file_get_contents("http://www.avto.net/_DEALER/results.asp?broker=12430&star=&izpis=1&oglasrubrika=7&oblika=0&subKAT=0&model=");
$pattern = '/<div class=\"contentwrapper\">(.*?)<\/div>/s';
preg_match($pattern, $html, $data);
$form = '/<form.*?>(.*?)<\/form>/s';
preg_match($form, $data[1], $cut);
$pattern2 ='/<table width="730" cellspacing="0" cellpadding="0" border="0">(.*?)<\/table>/s';
preg_match_all($pattern2, $cut[1], $tabele);
echo "<pre>";
print_r($cut[0]);
echo "</pre>";
echo "<br />";
echo "<br />";
echo "<pre>";
print_r($tabele);
echo "</pre>";
I need contentwrapper class, but I have to clean it up a little so it would show only the table with car parts, no extra text or page numbers needed. The first preg_match is working well, but when trying to get all these tables -> (.*?), the result is none. Any tip is welcome. I also tried with "Simple HTML DOM parser" who has the function file_get_html(), but its way to much that I need, I need to get just the list of items from first page (not from all 30 pages..) to present them on my page.
Any help/tip is appreciated.