Codice PHP:
Computed route from PALERMO/PUNTA RAISI (LICJ, LI) to ROMA/FIUMICINO (LIRF, LI): 9 fixes, 238.8 nautical miles
Cruise altitude between FL290 and FL390
LICJ (0.0nm) -SID-> LURON (40.7nm) -UM726-> DORAS (85.2nm) -UM726->
BEROL (121.6nm) -UM726-> ENSOT (141.4nm) -UM726-> PNZ (164.1nm) -UM726->
CIRCE (190.1nm) -UM726-> LAT (204.6nm) -STAR-> LIRF (238.8nm)
Details:
ID FREQ TRK DIST Coords Name/Remarks
LICJ 0 0 N38°10'55.00" E013°05'58.00" PALERMO/PUNTA RAISI
LURON 1 41 N38°51'32.00" E013°06'57.00" LURON
DORAS 356 45 N39°35'56.00" E013°03'36.00" DORAS
BEROL 356 36 N40°12'17.00" E013°00'47.00" BEROL
ENSOT 356 20 N40°32'00.00" E012°59'15.00" ENSOT
PNZ 114.6 356 23 N40°54'42.70" E012°57'26.70" PONZA
CIRCE 13 26 N41°20'00.00" E013°05'00.00" CIRCE
LAT 111.2 329 15 N41°32'28.00" E012°55'05.00" LATINA
LIRF 297 34 N41°48'01.00" E012°14'20.00" ROMA/FIUMICINO
Tracks are magnetic, distances are in nautical miles. LICJ SID LURON UM726 LAT STAR LIRF
Codice PHP:
<?php
$routefinder=($_REQUEST['routefinder']);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
$routefinder = str_replace(' ', ' ', $routefinder);
// stampa tutto il testo
echo $routefinder;
// cerca ed estrae l'aeroporto di arrivo
$a = strpos($routefinder, ') to ');
$destination_aerodrome = substr($routefinder, -4, $a);
// cerca ed estrae l'aeroporto di partenza
$b = $a -8;
$departure_aerodrome = substr($routefinder, $b, 4);
// cerca ed estrae la distanza
$c = strpos($routefinder, 'nautical miles');
$distance1 = substr($routefinder, $c - 7, 6);
$distance2 = str_replace(',', ' ', $distance1);
$distance3 = ltrim($distance2);
$distance4 = str_replace('.', ',', $distance3);
// cerca ed estrae la rotta
$d = strpos($routefinder, 'Tracks are magnetic, distances are in nautical miles. ');
$route1 = substr($routefinder, $d + 54);
$route2 = str_replace($destination_aerodrome, ' ', $route1);
$route3 = str_replace($departure_aerodrome, ' ', $route2);
$route4 = str_replace('SID', ' ', $route3);
$route5 = str_replace('STAR', ' ', $route4);
$route6 = ltrim($route5);
// cerca ed estrae i vari punti
$e = strpos($routefinder, 'Name/Remarks');
$f = substr($routefinder, $e + 14);
$g = strpos($f, 'Tracks are magnetic, distances are in nautical miles. ');
$h = substr($f, $g);
$i = str_replace($h, '', $f);
$l = str_replace('\r', ' ', $i);
?>
<?php
echo $a;
echo "destination_aerodrome=".$destination_aerodrome;
?>
<?php
echo $b;
echo "departure_aerodrome=".$departure_aerodrome;
?>
<?php
echo $c;
echo "distance=".$distance4;
?>
<?php
echo $d;
echo "route=".$route6;
?>
<?php
echo $e;
echo "routeeeeeeeeeee=".$l;
Come potete vedere dal codice ho provato a portare la stringa che definisce la variabile $l in un unica riga, ma senza risultati. Ho provato a fare anche un explode, ma nulla.