|
DVB-Widget – Der Abfahrtsmonitor
Antworten
|
|
 26 Mar 2010, 14:08
|
Neuling
Punkte: 3
seit: 22.01.2009
|
Danke für die Tipps, werde heute abend mal sehen, wenn ich Zeit hab. Hier mal das PHP Script; p.s. bin kein experte ;-) CODE <?php $haltestelle ="tudresden"; $url = "http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort=Dresden&hst=1.$haltestelle.&vz=1"; $data = file_get_contents($url); $rest = substr($data, 1, -1); $rest = str_replace(""", "", $rest); $split = preg_split("/,/", $rest, 0, PREG_SPLIT_NO_EMPTY ); $y=0; echo $haltestelle."<br>---------------<br>"; for ( $x = 0; $x < count ( $split ) / 3; $x++ ) { echo $split[$y]." ".$split[$y+1]." ".$split[$y+2]."<br>"; $y = $y+3; } ?> EDIT:Oben waren ein paar Fehler drin ging schon mit der URL Zusammensetzung los. Keine Ahnung, warum er es damals immer geschluckt hat. So Sieht es jetzt aus: CODE <?php $haltestelle ="tudresden"; $url = "http://widgets.vvo-online.de/abfahrtsmonitor/Abfahrten.do?ort=Dresden&hst=".$haltestelle."&vz=1"; function get_results($url) { $ch = curl_init($url); curl_setopt ($ch, CURLOPT_URL, "$url"); curl_setopt ($ch, CURLOPT_REFERER, "$url_ref"); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0"); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); $result = curl_exec ($ch); curl_close ($ch); return $result; } $data = get_results($url); $rest = substr($data, 1, -1); $rest = str_replace(""", "", $rest); $split = preg_split("/,/", $rest, 0, PREG_SPLIT_NO_EMPTY ); $y=0; echo $haltestelle."<br>---------------<br>"; for ( $x = 0; $x < count ( $split ) / 3; $x++ ) { echo $split[$y]." ".$split[$y+1]." ".$split[$y+2]."<br>"; $y = $y+3; }
?> Dieser Beitrag wurde von buggy: 27 Mar 2010, 00:47 bearbeitet
|
|
|
1 Nutzer liest/lesen dieses Thema (1 Gäste)
0 Mitglieder:
|