Studiati questo codice:
Codice PHP:
<pre>
<?php
$results = array();
$url = 'http://cnt.rm.ingv.it/~earthquake/index_web_cnt.php?year=2009&month=04&ml_selection=0';
$content = file_get_contents($url);
$pattern = '#<tr class="print_.*?</tr>#si';
if (preg_match_all($pattern, $content, $rows)) {
foreach ($rows[0] as $row) {
$pattern = '#<td[^>]*>(.*?)</td>#si';
if (preg_match_all($pattern, $row, $matches)) {
$results[] = $matches[1];
}
}
}
print_r($results);
?>
</pre>