I have a problem - a parser that does not parse. It does not work! It gives not back anything! Well, I want to get something back - and store the results in a mysql-database.
<?PHP
// Original PHP code by Chirp Internet: http://www.chirp.com.au
// Please acknowledge use of this code by including this header.
$url = "http://www.edi.admin.ch/esv/00475/00698/index.html?lang=de";
//$input = @file_get_contents($url) or die("Could not access file: $url");
$input = file_get_contents($url) or die("Could not access file: $url");
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
if(preg_match_all("/$regexp/siU", $input, $matches, PREG_SET_ORDER))
{
foreach($matches as $match)
{
// $match[2] = all the data i want to collect...
// $match[3] = text that i need to collect - see a detail-page
}
}
?>
It goes a bit over my head: It does not give back any results. Do I have to use file_get_contents()
with a query string?