ich betreue eine Vereins-Website, wobei ich allerdings zugeben muss, keine bis wenig PHP-Kenntnisse zu haben.
Ich möchte gerne den Spielverlauf der Liga aus einer xml-Datei auslesen. Die Struktur der Datei sieht so aus:
Hello,
I maintain a sportsclub website, although I must admit to have little to no knowledge of PHP.
I would like to read the history of the league table from a xml file. The structure of the file looks like this:
Code: Alles auswählen
<html>
<head>
...
</head>
<body>
...
<content>
<div class="samsContentBox ">
<div class="samsContentBoxHeader">
Mannschaft
</div>
<div class="samsContentBoxContent">
...
</div>
</div>
<div class="samsContentBox ">
<div class="samsContentBoxHeader">
Tabellenverlauf
</div>
<div class="samsContentBoxContent">
<p>
<table class="samsDataTable">
...
</table>
</p>
<div></div>
</div>
</div>
<div class="samsContentBox ">
<div class="samsContentBoxHeader">
Spielverlauf
</div>
<div class="samsContentBoxContent">
<p>
------------------------------------------------
<table class="samsDataTable">
<tbody>
...
</tbody>
</table>
------------------------------------------------
...
</body>
</html>
Ich bin mir ziemlich sicher, dass das nur ein 5-Zeiler ist. Ich bekomms aber nicht hin.
As you can seen, there are two tables. Both have the class samsDataTable. I need the second table, so the marked area.
I'm pretty sure that this is only a 5-slice. But I can't figure it out.
Ich habe es zwar hinbekommen, die Datei auszulesen, aber das Ergebnis bringt mich so nicht weiter:
I can read the file and output, but the result so does not help me:
Code: Alles auswählen
$host = "FILEADDRESS";
$filestring = file_get_contents($host);
$startpos = 0;
while($pos = strpos($filestring, "<table class="samsDataTable">", $startpos))
{
$string = substr($filestring, $pos, strpos($filestring, "</table>", $pos + 1) - $pos);
echo $string."</br>";
$startpos = $pos + 1;
}
This code of course shows everything from the first class samsDataTable.
Can anybody help me out?