Her er hele siden test2.php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// Path Settings
ini_set("allow_url_fopen", 1);
$uri = "
http://www.danskfodbold.dk/sr/web_position.asp?poolid=6466&saeson=2003";$detaljeret_stilling = "
http://www.danskfodbold.dk/web_default.asp?Menu=resultater&Site=/sr/web_position_detail.asp%3Fpoolid%3D6466%26saeson%3D2003";$kampprogram = "STI_TIL_KAMPPROGRAM";
$komplet_kanpprogram = "STI_TIL_KOMPLET_KAMPPROGRAM";
$oversigt = "STI_TIL_OVERSIGT";
$hold = "STI_TIL_HOLD";
// Read entire site into a string
$html = file($uri);
// Read entire site into a string
//$html = implode("", file($uri));
// Strip the newlines (\n) and (\r) Windows style!
$html = preg_replace("/[\n|\r]/", "", $html);
// Grep the string for the menu
preg_match('/(<!-- indhold -->)(.*)(<table border="0" cellpadding="0" cellspacing="0" width="600" class=TABLECELLNOCURSOR ID="Table5">)/im', $html, $matches);
// Replace
$matches[2] = preg_replace('/(.*)(<a href=")(.*?)(" class="BlackLink">Detaljeret stilling<\/a>)/', "$1$2$detaljeret_stilling$4", $matches[2]);
$matches[2] = preg_replace('/(.*)(<a href=")(.*?)(" class="BlackLink">Kampprogram<\/a>)/', "$1$2$kampprogram$4", $matches[2]);
$matches[2] = preg_replace('/(.*)(<a href=")(.*?)(" class="BlackLink">Komplet kampprogram<\/a>)/', "$1$2$komplet_kanpprogram$4", $matches[2]);
$matches[2] = preg_replace('/(.*)(<a href=")(.*?)(" class="BlackLink">Oversigt<\/a>)/', "$1$2$oversigt$4", $matches[2]);
// Format the table into a string nicely
$menu = preg_replace("/(\t)+/", "\n", $matches[2]);
// Grep the string for the table
preg_match('/(<table border="0" cellpadding="0" cellspacing="0" width="600" class=TABLECELLNOCURSOR ID="Table5">)(.*)(<\/table>)(.*?)(Denne række administreres af)/im', $html, $matches);
$score = $matches[1].$matches[2].$matches[3];
$score = preg_replace('/(.*)(CLASS="TABLECELL"><a href=")(.*?)(" class="BlackLink">Ellidshøj IF 2<\/a>)/', "$1$2$hold$4", $score);
// Format the table into a string nicely
$score = preg_replace("/(\t)+/", "\n", $score);
// Get teams and link
preg_match_all('/(CLASS="TABLECELL"><a href=")(.*?)(" class="BlackLink">)(.*?)(<\/a>)/im', $score, $matches);
for ($i=0; $i<count($matches[4]); $i++) {
if ( $matches[4][$i] == 'Ellidshøj IF 2' )
$matches[2][$i] = $hold;
$teams[] = array('team' => $matches[4][$i], 'link' => $matches[2][$i]);
}
// The following variables are avalible:
/*
$menu : Contains entire top menu.
$score : Contains entire scoreboard.
$teams : Multidimensional array containing the tupple (team, link)
*/
?>
<table width="200">
<tr>
<td><?php print $menu;?></td>
</tr>
<tr>
<td><?php print $score;?></td>
</tr>
<tr>
<td>--- $teams ---</td>
</tr>
</table>
</body>
</html>