$idstop, "dataOraField" => $orario, "dataOraFieldSpecified" => "true", "includiSeInPalinaField"=>"false", "includiSeInPalinaFieldSpecified"=>"false", "maxRighePerGruppoField"=>"0", "maxRighePerGruppoFieldSpecified"=>"false", "minutiTolleranzaField"=>"1", "minutiTolleranzaFieldSpecified"=>"true", "minutiTolleranzaRealTimeField"=>"10", "minutiTolleranzaRealTimeFieldSpecified"=>"true", "soloCorsePartiteField"=>"true", "soloCorsePartiteFieldSpecified"=>"false", "tipoField"=>"Arrivo", "tipoFieldSpecified"=>"true" ); try { $options = array( 'soap_version'=>SOAP_1_1, 'exceptions'=>true, 'trace'=>1, 'cache_wsdl'=>WSDL_CACHE_NONE ); $client = new SoapClient('http://88.33.222.43/AVMWebService/Service.svc?wsdl', $options); $results = $client->GetArriviPartenzePalinaExt(array('parametri'=>$params)); } catch (Exception $e) { echo "

Errore di accesso ai dati sui Trasporti RealTime. ci scusiamo. riprovate piĆ¹ tardi.

"; } $results = $client->GetArriviPartenzePalinaExt(array('parametri'=>$params)); $risultati=json_encode($results,true); $oraripaline=$results->{'GetArriviPartenzePalinaExtResult'}->{'oggettiField'}->{'ArrivoPartenzaPalina'}; if ($oraripaline == null) { echo "

Non ci sono arrivi nelle prossime ore\n

"; }else echo "
"; foreach ($oraripaline as $key => $value) { $time = strtotime($value->{'dataOraPassaggioPalinaField'}); $newformat = date('H:i:s',$time); if ($value->{'idCorsaField'} == null){ echo "non ci sono dati"; exit; } $route=get_corse($value->{'idCorsaField'}); $scostamento=$value->{'minutiScostamentoField'}; echo ""; } echo "
Linea (Tratta)Arrivo realeritardo sul previsto (min)
".get_linee($route)."".$newformat."".$scostamento."
"; function get_corse($corsa) { $corsa=trim($corsa); $corsa1="0000".$corsa; //echo $corsa1; $url="trips.txt"; $inizio=1; $homepage =""; $csv = array_map('str_getcsv', file($url)); $count = 0; foreach($csv as $data=>$csv1){ $count = $count+1; } if ($count == 0){ $homepage="Nessun corsa"; } if ($count > 40){ $homepage="errore generico corsa"; } for ($i=$inizio;$i<$count;$i++){ $filter= $csv[$i][2]; if (strpos($filter,$corsa1) !== false ){ $homepage =$csv[$i][0]; } } return $homepage; } function get_linee($linea) { $linea=trim($linea); $url1="routes.txt"; $inizio1=1; $homepage1 =""; $csv1 = array_map('str_getcsv', file($url1)); $count1 = 0; foreach($csv1 as $data1=>$csv11){ $count1 = $count1+1; } if ($count1 == 0){ $homepage1="Nessuna linea"; } if ($count > 40){ $homepage1="errore generico linea"; } for ($ii=$inizio1;$ii<$count1;$ii++){ $filter1= $csv1[$ii][0]; if ($filter1==$linea){ $homepage1 =$csv1[$ii][2]."
(".$csv1[$ii][3].") "; } } return $homepage1; } function get_stopid($linea) { $linea=trim($linea); $corsa1="0000".$linea; $url1="stop_times.txt"; $inizio1=1; $homepage1 =""; $csv1 = array_map('str_getcsv', file($url1)); $count1 = 0; foreach($csv1 as $data1=>$csv11){ $count1 = $count1+1; } if ($count1 == 0){ $homepage1="Nessuna linea"; } if ($count > 40){ $homepage1="errore generico linea"; } for ($ii=$inizio1;$ii<$count1;$ii++){ $filter1= $csv1[$ii][0]; if (strpos($filter1,$corsa1) !== false ){ $homepage1 =$csv1[$ii][1]."
\n"; } } return $homepage1; } ?>