Récupération de données JSON
Bonjour, j'ai un problème j'arrive à affiché le dernier tableau de mon json mais seulement pas les autres
pouvez-vous m'aider merci d'avance
Mon fichier JSON:
Array ( [0] => {"aaData" [1] => [{"callsign" [2] => "HAF1","realname" [3] => "Patrick ","fstype" [4] => "FSX","rank" [5] => "5","ccccccc" [6] => "0.0.4.Y","plane_onground" [7] => "Ground","planned_aircraft" [8] => "T\/CORS\/F","planned_depairport" [9] => "LFRH","planned_destairport" [10] => "LFRH","server" [11] => "helico-avions.","time_connected" [12] => "00 [13] => 42 [14] => 54","altitude" [15] => "167","plane_hdg" [16] => "148","groundspeed" [17] => "0","lat" [18] => "47.759588","long" [19] => "-3.441496","transponder" [20] => "1200","remarks" [21] => "","route" [22] => "","flighttype" [23] => ""},{"callsign" [24] => "FSFLY","realname" [25] => "Fs FLYBOYS","fstype" [26] => "FSX","rank" [27] => "2","dafwings" [28] => "0.0.4.X","plane_onground" [29] => "Ground","planned_aircraft" [30] => "T\/F18\/F","planned_depairport" [31] => "","planned_destairport" [32] => "","server" [33] => "FsFlyboys","time_connected" [34] => "37 [35] => 28 [36] => 18","altitude" [37] => "178","plane_hdg" [38] => "318","groundspeed" [39] => "0","lat" [40] => "63.992747","long" [41] => "-22.634425","transponder" [42] => "1200","remarks" [43] => "","route" [44] => "","flighttype" [45] => ""},{"callsign" [46] => "ACF01","realname" [47] => "Denis ","fstype" [48] => "P3D","rank" [49] => "12","ccccccc" [50] => "0.0.4.X","plane_onground" [51] => "Airborne","planned_aircraft" [52] => "T\/MD11\/F","planned_depairport" [53] => "LFRS","planned_destairport" [54] => "GOOY","server" [55] => "-Aventure-","time_connected" [56] => "03 [57] => 36 [58] => 01","altitude" [59] => "37058","plane_hdg" [60] => "202","groundspeed" [61] => "478","lat" [62] => "29.359042","long" [63] => "-9.798184","transponder" [64] => "2000","remarks" [65] => "FLIGHT PREPAR3D V2.2","route" [66] => "NORMI2N NORMI UN867 BLV UL14 NEA UN864 PIMOS UN869 ADM UR975 SLO SLO.OMUBA1N","flighttype" [67] => ""}]} )
résultat JSON php:
object(stdClass)[2]
public 'aaData' =>
array (size=3)
0 =>
object(stdClass)[3]
public 'callsign' => string 'ACF01' (length=5)
public 'realname' => string 'Denis ' (length=14)
public 'fstype' => string 'P3D' (length=3)
public 'rank' => string '12' (length=2)
public 'ccccc' => string '0.0.4.X' (length=7)
public 'plane_onground' => string 'Airborne' (length=8)
public 'planned_aircraft' => string 'T/MD11/F' (length=8)
public 'planned_depairport' => string 'GMMN' (length=4)
public 'planned_destairport' => string 'KJFK' (length=4)
public 'server' => string '-Aventure-' (length=14)
public 'time_connected' => string '03:06:51' (length=8)
public 'altitude' => string '38322' (length=5)
public 'plane_hdg' => string '286' (length=3)
public 'groundspeed' => string '511' (length=3)
public 'lat' => string '39.084087' (length=9)
public 'long' => string '-33.620902' (length=10)
public 'transponder' => string '2000' (length=4)
public 'remarks' => string 'FLIGHT PREPAR3D V2.2' (length=20)
public 'route' => string 'ODAXA UH899 IBALU DCT BEXAL DCT LUTAK DCT 3820N 3930N 3940N 3950N 4060N DCT DOVEY DCT PARCH' (length=91)
public 'flighttype' => string '' (length=0)
1 =>
object(stdClass)[4]
public 'callsign' => string 'ACF59' (length=5)
public 'realname' => string '>Joan ' (length=20)
public 'fstype' => string 'FS9' (length=3)
public 'rank' => string '8' (length=1)
public 'ccccc' => string '0.0.4.X' (length=7)
public 'plane_onground' => string 'Ground' (length=6)
public 'planned_aircraft' => string 'T/A332/F' (length=8)
public 'planned_depairport' => string 'DIAP' (length=4)
public 'planned_destairport' => string 'GCFV' (length=4)
public 'server' => string '-Aventure-' (length=14)
public 'time_connected' => string '15:20:43' (length=8)
public 'altitude' => string '36' (length=2)
public 'plane_hdg' => string '309' (length=3)
public 'groundspeed' => string '0' (length=1)
public 'lat' => string '5.250678' (length=8)
public 'long' => string '-3.932632' (length=9)
public 'transponder' => string '1200' (length=4)
public 'remarks' => string 'AVENTURE / TCAS EQUIPED/FRENCH / DEPART LE 15/08/2014 A 1000 Z' (length=75)
public 'route' => string 'BKY UG851 BKO UM122 OPARA UR977 DEPOX UM122 EREMO UR977 IPONA UM122 EBATI UR977 ADM UN869 RUSIK DCT' (length=99)
public 'flighttype' => string '' (length=0)
2 =>
object(stdClass)[5]
public 'callsign' => string 'FSFLY' (length=9)
public 'realname' => string 'Fs FLY' (length=10)
public 'fstype' => string 'FSX' (length=3)
public 'rank' => string '2' (length=1)
public 'ccccc' => string '0.0.4.X' (length=7)
public 'plane_onground' => string 'Ground' (length=6)
public 'planned_aircraft' => string 'T/F18/F' (length=7)
public 'planned_depairport' => string '' (length=0)
public 'planned_destairport' => string '' (length=0)
public 'server' => string 'FsFlyboys' (length=9)
public 'time_connected' => string '58:40:02' (length=8)
public 'altitude' => string '178' (length=3)
public 'plane_hdg' => string '18' (length=2)
public 'groundspeed' => string '0' (length=1)
public 'lat' => string '63.996437' (length=9)
public 'long' => string '-22.632319' (length=10)
public 'transponder' => string '1200' (length=4)
public 'remarks' => string '' (length=0)
public 'route' => string '' (length=0)
public 'flighttype' => string '' (length=0)
mon code complet:
$json = file_get_contents("mon_url.json");
$parsed_json = json_decode($json,false);
$connect = array();
$server = $parsed_json->{'aaData'}[2]->{'server'};
$Callsign = $parsed_json->{'aaData'}[2]->{'callsign'};
$realname = $parsed_json->{'aaData'}[2]->{'realname'};
$fstype = $parsed_json->{'aaData'}[2]->{'fstype'};
$planned_depairport = $parsed_json->{'aaData'}[2]->{'planned_depairport'};
$planned_destairport = $parsed_json->{'aaData'}[2]->{'planned_destairport'};
$planned_aircraft = $parsed_json->{'aaData'}[2]->{'planned_aircraft'};
$plane_onground = $parsed_json->{'aaData'}[2]->{'plane_onground'};
$time_connected = $parsed_json->{'aaData'}[2]->{'time_connected'};
echo "${server}\n";
echo "${Callsign}\n";
echo "${realname}\n";
echo "${fstype}\n";
echo "${planned_depairport}\n";
echo "${planned_destairport}\n";
echo "${planned_aircraft}\n";
echo "${plane_onground}\n";
echo "${time_connected}\n";
?>
affichage tableau:
magin IMG07-B Georges - ATC FS9 T/BE58/F Ground -1:59:20
Réponses apportées à cette discussion
Bonjour,
merci d'utiliser la syntaxe Markdown pour insérer des éléments de code. Je n'éditerai pas toujours les messages et si je n'arrive pas à les lire, je n'y répondrai pas.
Ce point étant réglé, comment est généré le JSON d'origine : j'ai regardé un peu et il ne semble pas être reconnu comme tel. Tout ce que j'obtiens en local avec json_decode, c'est NULL et non l'objet attendu, donc il doit en manquer des bouts quelque part.
Merci pour votre aide et pour avoir éditer mon message . Pour le fichier json je n'ai pas mis l'URL exact mais je peux vous l'envoyer http://www.dafsim.com/whazzupdcs/pilotdata.json . Cordialement Denis
Ok, j'ai testé à nouveau avec l'url : voici ce que me donne un var_dump:
object(stdClass)#1 (1) {
["aaData"]=>
array(15) {
[0]=>
object(stdClass)#2 (20) {
["callsign"]=>
string(6) "VAA670"
["realname"]=>
string(15) "Victor LEMAITRE"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(2) "11"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(8) "T/AS50/F"
["planned_depairport"]=>
string(4) "LFNA"
["planned_destairport"]=>
string(4) "LFNA"
["server"]=>
string(14) "VirtuelAirAlsa"
["time_connected"]=>
string(8) "00:04:58"
["altitude"]=>
string(4) "1972"
["plane_hdg"]=>
string(2) "22"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "44.459724"
["long"]=>
string(8) "6.038412"
["transponder"]=>
string(4) "7000"
["remarks"]=>
string(0) ""
["route"]=>
string(19) "LFMC LFMQ LFMA LFMY"
["flighttype"]=>
string(0) ""
}
[1]=>
object(stdClass)#3 (20) {
["callsign"]=>
string(6) "F-FBTT"
["realname"]=>
string(14) "Michel GUERNEZ"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.I"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/PA34/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "02:41:02"
["altitude"]=>
string(4) "8618"
["plane_hdg"]=>
string(3) "287"
["groundspeed"]=>
string(3) "126"
["lat"]=>
string(9) "27.271199"
["long"]=>
string(9) "91.497561"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[2]=>
object(stdClass)#4 (20) {
["callsign"]=>
string(6) "OO-DAM"
["realname"]=>
string(11) "Daniel CHOT"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.W"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(7) "T/A21/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "02:28:38"
["altitude"]=>
string(4) "7708"
["plane_hdg"]=>
string(3) "223"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "27.259772"
["long"]=>
string(9) "91.511534"
["transponder"]=>
string(4) "7000"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[3]=>
object(stdClass)#5 (20) {
["callsign"]=>
string(6) "F-PY13"
["realname"]=>
string(21) "Jean-pierre DROMNELLE"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.I"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(8) "T/BE58/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "02:13:44"
["altitude"]=>
string(4) "7706"
["plane_hdg"]=>
string(3) "306"
["groundspeed"]=>
string(2) "23"
["lat"]=>
string(9) "27.259505"
["long"]=>
string(9) "91.510468"
["transponder"]=>
string(4) "7000"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[4]=>
object(stdClass)#6 (20) {
["callsign"]=>
string(6) "F-MU68"
["realname"]=>
string(11) "Paolo SIMON"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.W"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/PC6T/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "00:43:11"
["altitude"]=>
string(5) "11047"
["plane_hdg"]=>
string(3) "259"
["groundspeed"]=>
string(2) "82"
["lat"]=>
string(9) "27.212062"
["long"]=>
string(9) "91.693687"
["transponder"]=>
string(4) "7000"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[5]=>
object(stdClass)#7 (20) {
["callsign"]=>
string(6) "F-BODP"
["realname"]=>
string(20) "Jean-marie GRINEVALD"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.W"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/C310/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "02:02:41"
["altitude"]=>
string(5) "11943"
["plane_hdg"]=>
string(3) "294"
["groundspeed"]=>
string(3) "156"
["lat"]=>
string(9) "27.214349"
["long"]=>
string(9) "91.522325"
["transponder"]=>
string(4) "7200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[6]=>
object(stdClass)#8 (20) {
["callsign"]=>
string(6) "F-RAIZ"
["realname"]=>
string(13) "Sylvain DAULT"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/DHC2/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(3) "LCA"
["time_connected"]=>
string(8) "00:58:29"
["altitude"]=>
string(4) "8819"
["plane_hdg"]=>
string(3) "325"
["groundspeed"]=>
string(3) "104"
["lat"]=>
string(9) "27.301256"
["long"]=>
string(9) "91.486231"
["transponder"]=>
string(4) "5600"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[7]=>
object(stdClass)#9 (20) {
["callsign"]=>
string(6) "TH1973"
["realname"]=>
string(10) "Taki HASAN"
["fstype"]=>
string(4) "XP10"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.X"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/B732/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "German-Flight."
["time_connected"]=>
string(8) "03:36:27"
["altitude"]=>
string(4) "2527"
["plane_hdg"]=>
string(2) "93"
["groundspeed"]=>
string(3) "251"
["lat"]=>
string(9) "52.989641"
["long"]=>
string(9) "11.879848"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[8]=>
object(stdClass)#10 (20) {
["callsign"]=>
string(5) "MBK70"
["realname"]=>
string(13) "Mike KUTSCHER"
["fstype"]=>
string(4) "XP10"
["rank"]=>
string(1) "5"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(8) "T/PA38/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "German-Flight."
["time_connected"]=>
string(8) "01:49:07"
["altitude"]=>
string(4) "1652"
["plane_hdg"]=>
string(2) "36"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "49.947354"
["long"]=>
string(8) "7.268339"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[9]=>
object(stdClass)#11 (20) {
["callsign"]=>
string(4) "BTBP"
["realname"]=>
string(13) "Thomas SCHELP"
["fstype"]=>
string(4) "XP10"
["rank"]=>
string(1) "4"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(7) "T/DC3/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "German-Flight."
["time_connected"]=>
string(8) "01:20:16"
["altitude"]=>
string(3) "163"
["plane_hdg"]=>
string(2) "67"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "52.364282"
["long"]=>
string(9) "13.506148"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[10]=>
object(stdClass)#12 (20) {
["callsign"]=>
string(4) "WM40"
["realname"]=>
string(15) "Walter MEVISSEN"
["fstype"]=>
string(4) "XP10"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(7) "T/DC3/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "German-Flight."
["time_connected"]=>
string(8) "01:07:00"
["altitude"]=>
string(3) "163"
["plane_hdg"]=>
string(2) "70"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "52.363970"
["long"]=>
string(9) "13.506363"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[11]=>
object(stdClass)#13 (20) {
["callsign"]=>
string(6) "NPS285"
["realname"]=>
string(15) ">Nps285 MASSIMO"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.Y"
["plane_onground"]=>
string(8) "Airborne"
["planned_aircraft"]=>
string(8) "T/AT72/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "Nephis-Airline"
["time_connected"]=>
string(8) "00:46:12"
["altitude"]=>
string(5) "22907"
["plane_hdg"]=>
string(3) "129"
["groundspeed"]=>
string(3) "307"
["lat"]=>
string(9) "22.485763"
["long"]=>
string(11) "-102.241482"
["transponder"]=>
string(4) "7000"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[12]=>
object(stdClass)#14 (20) {
["callsign"]=>
string(7) "TND2508"
["realname"]=>
string(12) "Werner NOWAK"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "7"
["dafwings"]=>
string(7) "0.0.4.W"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(8) "T/DA40/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(14) "Team-Niederbay"
["time_connected"]=>
string(8) "00:04:22"
["altitude"]=>
string(2) "25"
["plane_hdg"]=>
string(3) "262"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "58.358116"
["long"]=>
string(11) "-134.576729"
["transponder"]=>
string(4) "2000"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[13]=>
object(stdClass)#15 (20) {
["callsign"]=>
string(9) "FSFLYBOYS"
["realname"]=>
string(10) "Fs FLYBOYS"
["fstype"]=>
string(3) "FSX"
["rank"]=>
string(1) "2"
["dafwings"]=>
string(7) "0.0.4.X"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(7) "T/F18/F"
["planned_depairport"]=>
string(0) ""
["planned_destairport"]=>
string(0) ""
["server"]=>
string(9) "FsFlyboys"
["time_connected"]=>
string(8) "17:51:06"
["altitude"]=>
string(3) "178"
["plane_hdg"]=>
string(3) "262"
["groundspeed"]=>
string(1) "3"
["lat"]=>
string(9) "63.992905"
["long"]=>
string(10) "-22.625791"
["transponder"]=>
string(4) "1200"
["remarks"]=>
string(0) ""
["route"]=>
string(0) ""
["flighttype"]=>
string(0) ""
}
[14]=>
object(stdClass)#16 (20) {
["callsign"]=>
string(5) "ACF01"
["realname"]=>
string(14) "Denis BOUSQUET"
["fstype"]=>
string(3) "P3D"
["rank"]=>
string(2) "12"
["dafwings"]=>
string(7) "0.0.4.X"
["plane_onground"]=>
string(6) "Ground"
["planned_aircraft"]=>
string(8) "T/MD11/F"
["planned_depairport"]=>
string(4) "FIMP"
["planned_destairport"]=>
string(4) "OMDB"
["server"]=>
string(14) "-AventureClub-"
["time_connected"]=>
string(8) "13:15:27"
["altitude"]=>
string(2) "47"
["plane_hdg"]=>
string(3) "210"
["groundspeed"]=>
string(1) "0"
["lat"]=>
string(9) "25.248875"
["long"]=>
string(9) "55.362997"
["transponder"]=>
string(4) "2000"
["remarks"]=>
string(20) "FLIGHT PREPAR3D V2.2"
["route"]=>
string(49) "UTIVA UR400 PRA UR401 SUHIL R401 GIDIS G783 BUBIN"
["flighttype"]=>
string(0) ""
}
}
}
En clair, ça fonctionne fort bien et ça nous indique quoi : que le fichier contient 15 lignes de données ( array(15) )
Pour tster toutes les lignes, j'ai expérimenté ceci :
$json = file_get_contents('http://www.dafsim.com/whazzupdcs/pilotdata.json');
$parsed_json = json_decode($json,false);
foreach($parsed_json->aaData as $i => $aaData)
{
$server = $aaData->server;
echo("<p>Serveur ". $i ." : ". $server ."</p>\n");;
}
Le résultat apparu a été normal :
Serveur 0 : VirtuelAirAlsa
Serveur 1 : LCA
Serveur 2 : LCA
Serveur 3 : LCA
Serveur 4 : LCA
Serveur 5 : LCA
Serveur 6 : LCA
Serveur 7 : German-Flight.
Serveur 8 : German-Flight.
Serveur 9 : German-Flight.
Serveur 10 : Nephis-Airline
Serveur 11 : Team-Niederbay
Serveur 12 : Team-Niederbay
Serveur 13 : FsFlyboys
C'est donc vers cette syntaxe là qu'il faudrait se tourner. Est-ce que c'est plus clair ?
Merci je vais essayer de faire mon tableau avec
comme ceci http://aventureclub-airlines.fr/Server_Statut/Server_Statut.php
Merci encore
Pas de quoi.
Si c'est pour construire un tableau comme celui du bas de page montré à l'url indiquée, alors effectivement, ça devrait parfaitement fonctionner. Sinon, reviens, montre un peu le bout de code de construction du tableau et on tâchera de voir où est l'erreur.
Juste une question le résultat de la liste des serveurs comme en haut est il possible de convertir en images ? Exemple VirtuelAirAlsa mettre un logo à la place merci
Pourquoi pas. Mais il faudrait pouvoir identifier le logo correspondant. Ça veut dire qu'un élément dans les données JSON permet d'identifier à quel logo correspond telle ligne. Et dans ce cas, il suffit de l'ajouter dans la construction du HTML.
Le truc à essayer : avoir les logos dans un répertoire avec chaque image nommée comme le serveur. Donc, tu pourrais avoir un VirtuelAirAlsa.png et dans ce cas, tu pourrais ajouter une balise <img src="./images/<?php echo($aaData->server); ?>" alt="" /> ou quelque chose dans ce genre.
re bonjour,
j'ai essayer comme suite mais sa fonctionne pas
$json = file_get_contents('http://www.dafsim.com/whazzupdcs/pilotdata.json');
$parsed_json = json_decode($json,false);
foreach($parsed_json->aaData as $i => $aaData)
{
$server = $aaData->$server;
$callsign = $aaData->$callsign;
$realname = $aaData->$realname;
$fstype = $aaData->$fstype;
$planned_depairport = $aaData->$planned_depairport;
$planned_destairport = $aaData->$planned_destairport;
$planned_aircraft = $aaData->$planned_aircraft;
$plane_onground = $aaData->$plane_onground;
$time_connected = $aaData->$time_connected;
echo ("server". $i ." : ".$server .");;
echo ("callsign". $i ." :".$callsign .");;
echo ("Realname". $i ." :".$realname .");;
echo "${fstype}";
echo "${planned_depairport}";
echo "${planned_destairport}";
echo "${planned_aircraft}";
echo "${plane_onground}";
echo "${time_connected}";
}
}
/**
* Ouverture du tableau HTML
*/
$sTableau = <<<CODE_HTML
<table>
<thead>
<tr>
<th class="style3" style="height: 7px; width: 7px;">Airline</th>
<th class="style3" style="height: 7px; width: 7px;">Callsign</th>
<th class="style3" style="height: 7px; width: 2px;">Name</th>
<th class="style3" style="height: 7px; width: 150px;">FS</th>
<th class="style3" style="height: 7px; width: 33px;">Departure</th>
<th class="style3" style="height: 7px; width: 31px;">Arrival</th>
<th class="style3" style="height: 7px; width: 31px;">Status</th>
<th class="style3" style="height: 7px; width: 9px;">Aircraft</th>
<th class="style3" style="height: 7px; width: 31px;">Online</th>
</tr>
</thead>
<tbody>
CODE_HTML;
/**
* Construction des lignes du tableau
*/
$sTableau .= <<<CODE_HTML
<tr>
<td class="style40" style="height: 9px; width: 9px;">{$server}</td>
<td class="style40" style="height: 9px; width: 9px;">{$callsign}</td>
<td class="style40" style="height: 9px; width: 9px;">{$realname}</td>
<td class="style40" style="height: 9px; width: 9px;">{$fstype}</td>
<td class="style40" style="height: 9px; width: 9px;">{$lanned_depairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_destairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_aircraft}</td>
<td class="style40" style="height: 9px; width: 9px;">{$plane_onground}</td>
<td class="style40" style="height: 9px; width: 9px;">{$time_connected}</td>
</tr>
CODE_HTML;
/**
* Fermeture du tableau HTML
*/
$sTableau .= <<<CODE_HTML
</tbody>
</table>
CODE_HTML;
$sTableau .= <<<CODE_HTML
</tbody>
</table>
CODE_HTML;
/**
* Affichage du tableau HTML
*/
echo($sTableau);
« mais sa fonctionne pas »
C'est la réponse typique quimalheureusement ne sert à rien parce qu'elle ne dit pas ce que ça fait de travers, n'indique pas les éventuels messages d'erreur ni les erreurs d'affichage.
Par ailleurs, je re recommande vivement de faire preuve de davantage de discipline dans l'écriture de ton code qui comporte des erreurs d'innatention franchement basiques. Et soigne l'alignement.
Enfin, ceci étant, en testant, j'ai quand même rapidement vu ce qui n'allait pas et je n'ai pu que constater que tu ne suis pas une logique qui devrait pourtant être éveidente.
Tu boucles sur ton tableau pour définir des variables, et en fin de compte, tu dois avoir surtout un paque d'erreurs à l'affichage, mais surtout, ça ne peut afficher que la dernière ligne dans la mesure où tu ne commences la construction du tableau qu'après la boucle. Comment t'imagines-tu donc que les lignes vont se répéter avec un contenu différent à chaque fois si ce n'est pas DANS la boucle ?
Essaye donc comme ceci :
<?php
$json = file_get_contents('http://www.dafsim.com/whazzupdcs/pilotdata.json');
$parsed_json = json_decode($json,false);
/**
* Ouverture du tableau HTML
*/
$sTableau = <<<CODE_HTML
<table>
<thead>
<tr>
<th class="style3" style="height: 7px; width: 7px;">Airline</th>
<th class="style3" style="height: 7px; width: 7px;">Callsign</th>
<th class="style3" style="height: 7px; width: 2px;">Name</th>
<th class="style3" style="height: 7px; width: 150px;">FS</th>
<th class="style3" style="height: 7px; width: 33px;">Departure</th>
<th class="style3" style="height: 7px; width: 31px;">Arrival</th>
<th class="style3" style="height: 7px; width: 31px;">Status</th>
<th class="style3" style="height: 7px; width: 9px;">Aircraft</th>
<th class="style3" style="height: 7px; width: 31px;">Online</th>
</tr>
</thead>
<tbody>
CODE_HTML;
/**
* Maintenant, on boucle et on construit les lignes du tableau
*/
foreach($parsed_json->aaData as $i => $aaData)
{
$server = $aaData->server;
$callsign = $aaData->callsign;
$realname = $aaData->realname;
$fstype = $aaData->fstype;
$planned_depairport = $aaData->planned_depairport;
$planned_destairport = $aaData->planned_destairport;
$planned_aircraft = $aaData->planned_aircraft;
$plane_onground = $aaData->plane_onground;
$time_connected = $aaData->time_connected;
/**
* Construction des lignes du tableau
*/
$sTableau .= <<<CODE_HTML
<tr>
<td class="style40" style="height: 9px; width: 9px;">{$server}</td>
<td class="style40" style="height: 9px; width: 9px;">{$callsign}</td>
<td class="style40" style="height: 9px; width: 9px;">{$realname}</td>
<td class="style40" style="height: 9px; width: 9px;">{$fstype}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_depairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_destairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_aircraft}</td>
<td class="style40" style="height: 9px; width: 9px;">{$plane_onground}</td>
<td class="style40" style="height: 9px; width: 9px;">{$time_connected}</td>
</tr>
CODE_HTML;
}
/**
* Fermeture du tableau HTML
*/
$sTableau .= <<<CODE_HTML
</tbody>
</table>
CODE_HTML;
/**
* Affichage du tableau HTML
*/
echo($sTableau);
Voilà. Dernier détail : quand tu postes du code, ça ne sert à rien de mettre des balises <pre> ou <code>, ce n'est pas du bbCode mais du Markdown, je t'ai donné le lien dans une réponse précédente, tu n'a pas du y regarder de trop près. Pour le code, sers-toi d'un éditeur de code, colles-y ton bout de code et décale le tout de quatre espaces vers la droite, ensuite, ici, laisse une ligne vide, colle ton code décalé comme ceci, ajoute une ligne vide et là ça va s'afficher correctement. Utilise le bouton de prévisualisation au besoin pour vérifier avant de poster.
merci
j'ai une erreur
Parse error: syntax error, unexpected '<<' (T_SL) in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 257
257 $sTableau = <<<CODE_HTML
As-tu veillé ;a ce que les délimiteurs de fin HEREDOC soient bien en début de ligne ?
j'ai beaucoup d'erreurs :(
_______________________________________________________________________
( ! ) Notice: Array to string conversion in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 280
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
________________________________________________________________________
( ! ) Notice: Undefined variable: i in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 280
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 282
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: server in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 282
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 282
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 282
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: callsign in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 283
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 283
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 283
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: realname in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 284
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 284
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 284
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: fstype in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 285
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 285
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 285
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: planned_depairport in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 286
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 286
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 286
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: planned_destairport in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 287
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 287
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 287
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
( ! ) Notice: Undefined variable: planned_aircraft in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 288
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
_______________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 288
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 288
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: plane_onground in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 289
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 289
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
_______________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 289
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: time_connected in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 290
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: aaData in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 290
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Trying to get property of non-object in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 290
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: sTableau in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 296
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: server in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 296
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: callsign in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 297
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: realname in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 298
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: fstype in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 299
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: planned_depairport in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 300
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: planned_destairport in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 301
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: planned_aircraft in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 302
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
( ! ) Notice: Undefined variable: plane_onground in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 303
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
_______________________________________________________________________
( ! ) Notice: Undefined variable: time_connected in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 304
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
_______________________________________________________________________
( ! ) Notice: Undefined variable: sTableau in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 317
Call Stack
# Time Memory Function Location
1 0.0004 259776 {main}( ) ..\Server_Statut.php:0
________________________________________________________________________
CODE_HTML; /** * Maintenant, on boucle et on construit les lignes du tableau */ foreach(Array as => ) { = htmlentities(); = ; = ; = ; = ; = ; = ; = ; = ; /** * Construction des lignes du tableau */ .= << CODE_HTML;
} ** * Fermeture du tableau HTML */ .= <<
désolé mais je suis perdu lol erreur suivant le code que tu ma proposé
Mouais, et tu peux d'ores et déjà considérer que si tu corriges la première erreur, toutes les autres vont disparaitre d'un coup.
Essaye d'analyser posément en commençant par le début : que te dit le premier message :
« ( ! ) Notice: Array to string conversion in D:\Program Files (x86)\wamp\www\Server_Statut.php on line 280
Call Stack »
Ce qui signifie qu'il y a dans ton code à la ligne 280 une tentative pour utiliser un tableau à la manière d'une chaine de caractères. Fais donc voir ton code à partir de la ligne 275 jusqu'à disons 282 ou 283, l'idée étant de repérer ce que tu as fait et comment détecter ce qui se passe au juste.
j'ai exactement mis ton code et bien à droite
par contre je n'arrive pas à utiliser Markdown
c'est bon j'ai rectifier
http://aventureclub-airlines.fr/Server_Statut/Server_Statut.php
reste plus qu'à changer les servers "colonne Airline" en images(LOGO)
Sans voir le code, impossible de t'aider
c'est bon j'ai rectifier
http://aventureclub-airlines.fr/Server_Statut/Server_Statut.php
reste plus qu'à changer les servers "colonne Airline" en images(LOGO)
LE CODE COMPLET:
<style type="text/css">
.style2 {
text-align: center;
font-size: small;
color: #00FF00;
background-color: #FFFFFF;
border-left-color: #A0A0A0;
border-right-color: #C0C0C0;
border-top-color: #A0A0A0;
border-bottom-color: #C0C0C0;
}
.style3 {
text-align: center;
font-size: x-small;
background-color: #66FF99;
white-space: nowrap;
}
.style33 {
font-size: x-small;
font-weight: bold;
background-color: #000000;
}
.style40 {
border-style: solid;
border-color: #81DAF5;
font-size: x-small;
text-align: center;
color: #0F0F10;
background-color: #81DAF5;
font-family: Raavi;
white-space: nowrap;
font-weight: normal;
}
.style44 {
border-style: solid;
border-color: #3366FF;
font-size: small;
text-align: center;
color: #FFFFFF;
background-color: #3366FF;
font-family: Raavi;
font-weight: normal;
text-decoration: blink;
}
.style46 {
border-style: solid;
border-color: #3366FF;
font-size: x-small;
text-align: center;
color: #FFFFFF;
background-color: #3366FF;
font-family: Raavi;
text-decoration: blink;
}
</style>
<meta content="3" name="arr" />
<table cellpadding="0" cellspacing="0" class="style33" align="center" style="z-index: 1; width: 20px; height: 65px; position: absolute; top: 7px; left: 5px">
<caption></caption><tr><td style="width: 352px"class="style40"><head><meta content="fr" http-equiv="Content-Language" /><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="../common.css" type="text/css"><link rel="stylesheet" href="CSS/form.style.css" type="text/css"><link rel="stylesheet" href="CSS/table_table_jui.css" type="text/css"><link rel="stylesheet" href="CSS/cupertino/jquery-ui-1.9.2.custom.min.css" type="text/css"><script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
<script src="js/dafsimform.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="js/jquery.form.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<style type="text/css">
.style3 {
text-align: center;
font-size: x-small;
background-color: #66FF99;
white-space: nowrap;
}
.style33 {
font-size: x-small;
font-weight: bold;
background-color: #000000;
}
.style40 {
border-style: solid;
border-color: #B2D0FE;
font-size: x-small;
text-align: center;
color: #000000;
background-color: #B2D0FE;
font-family: Raavi;
white-space: nowrap;
font-weight: normal;
}
</style><meta content="3" name="arr" /><title>Statut Server AventureClub Airlines</title></head><body style="margin: 5; background-attachment: fixed">
<table cellspacing="1" class="style43" style="float: none; width: 1288px; height: 930px; z-index: 24; position: absolute; top: 2px; left: 2px;" align="center"><caption></caption><tr><th style="width: 903px; height: 48px;"class="style40"><head><meta content="fr" http-equiv="Content-Language" /><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="../common.css" type="text/css"><link rel="stylesheet" href="CSS/form.style.css" type="text/css"><link rel="stylesheet" href="CSS/table_table_jui.css" type="text/css"><link rel="stylesheet" href="CSS/cupertino/jquery-ui-1.9.2.custom.min.css" type="text/css"><script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
<script src="js/dafsimform.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="js/jquery.form.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<style type="text/css">
.style3 {
text-align: center;
font-size: x-small;
background-color: #66FF99;
white-space: nowrap;
}
.style40 {
border-style: solid;
border-color: #B2D0FE;
font-size: x-small;
text-align: center;
color: #000000;
background-color: #B2D0FE;
font-family: Raavi;
white-space: nowrap;
font-weight: normal;
}
</style>
<style type="text/css">
.style3 {
border-left-style: solid;
border-left-width: 3px;
border-right: 3px solid #C0C0C0;
border-top-style: solid;
border-top-width: 3px;
border-bottom: 3px solid #C0C0C0;
}
.style41 {
border: 3px solid #000000;
}
.style43 {
font-size: x-small;
font-weight: bold;
border: 3px solid #000000;
background-color: #000000;
margin-top: 1px;
margin-right: 0px;
}
.style44 {
margin-left: 0px;
margin-top: 0px;
}
.style46 {
font-size: x-small;
text-align: center;
color: #FFFFFF;
font-family: Raavi;
text-decoration: blink;
border: 1px solid #3366FF;
margin-top: 0px;
background-color: #3366FF;
}
</style>
<table class="style41" style="width: 1279px; height: 46px; z-index: 1; position: absolute; top: 6px; left: 1px;"><tr><th class="style3" ><div class="annonce">
<marquee onmouseover="this.stop()" onmouseout="this.start()" scrollamount="5"><span style="color: #DC143C; font-size: 20px; font-family: Raavi text-shadow: 0px 0px 10px LUEUR QUI ENTOURE LE TEXTE;"><img src="http://aventureclub-airlines.fr/ImageACF/Banni%C3%A8re%20ACF%20Aventureclub%20Airlines.jpg85x18%20copy.gif"> Rejoignez-nous avec votre simulateur de vol: FS9, FSX, Xplane9, XPlane10, Prepar3D et partagez de bons moments ensemble <img src="http://aventureclub-airlines.fr/ImageACF/Banni%C3%A8re%20ACF%20Aventureclub%20Airlines.jpg85x18%20copy.gif"></span></marquee></div></th></tr></table>
<table align="center" class="style46" cellpadding="0" cellspacing="0"><tr style="z-index: 1; position: absolute; top: 57px; left: 13px"><th class="style47">
<iframe src="http://www.dafsim.com/map/?va=-AventureClub-&output=embed" frameborder="3" marginwidth="3" marginheight="3" scrolling="no" class="style44" style="width: 1253px; height: 823px; z-index: 1; position: absolute; top: 7px; left: 0px; float: center;" align="middle" name="Map"></iframe>
<table cellpadding="0" cellspacing="0" class="style2" style="z-index: 1; width: 362; height: 64; position: absolute; top: 642px; left: 451px"><tr>
<td style="width: 339; height: 59;"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="fr" http-equiv="Content-Language" /><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><style type="text/css">
.style2 {
border: 3px solid #000000;
text-align: center;
font-size: small;
color: #00FF00;
background-color: #C0C0C0;
}
.style3 {
text-align: center;
font-size: x-small;
background-color: #66FF99;
white-space: nowrap;
}
style="background-image: url(http://aventureclub-airlines.fr/ImageACF/LOGO-ACF.JPG);"
</style>
<meta content="3" name="arr" /></head><body style="background-attachment: fixed"><table cellpadding="0" cellspacing="0" class="style33" style="float: left" align="left"><caption></caption><tr><td style="width: 356px; height: 19px;"class="style69"><head><meta content="fr" http-equiv="Content-Language" /><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="../common.css" type="text/css"><link rel="stylesheet" href="CSS/form.style.css" type="text/css"><link rel="stylesheet" href="CSS/table_table_jui.css" type="text/css"><link rel="stylesheet" href="CSS/cupertino/jquery-ui-1.9.2.custom.min.css" type="text/css"><script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
<script src="js/dafsimform.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="js/jquery.form.js" type="text/javascript"></script>
<script src="js/jquery.validate.min.js" type="text/javascript"></script>
<style type="text/css">
.style3 {
text-align: center;
font-size: x-small;
background-color: #66FF99;
white-space: nowrap;
}
.style33 {
font-size: x-small;
font-weight: bold;
background-color: #000000;
}
.style40 {
border-style: solid;
border-color: #B2D0FE;
font-size: x-small;
text-align: center;
color: #000000;
background-color: #B2D0FE;
font-family: Raavi;
white-space: nowrap;
font-weight: normal;
}
.style47 {
border: 1px solid #FFFFFF;
font-size: x-small;
font-weight: bold;
background-color: #FFFFFF;
}
.style69 {
font-size: x-small;
color: #000000;
font-family: Raavi;
white-space: nowrap;
font-weight: normal;
border-style: solid;
border-color: #B2D0FE;
background-color: #B2D0FE;
}
span.menuelink{
margin: 8px;
}
</style>
<HEAD><meta http-equiv='refresh' content='60;url='http://localhost/Server_Statut.php/></HEAD>
<?php
$bdd = NEW PDO('mysql:host=localhost;dbname=server_statut','root','', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
$json = file_get_contents('http://www.dafsim.com/whazzupdcs/pilotdata.json');
$parsed_json = json_decode($json,false);
/**
* Ouverture du tableau HTML
*/
$sTableau = <<<CODE_HTML
<table>
<thead>
<tr>
<th class="style3" style="height: 7px; width: 7px;">Airline</th>
<th class="style3" style="height: 7px; width: 7px;">Callsign</th>
<th class="style3" style="height: 7px; width: 2px;">Name</th>
<th class="style3" style="height: 7px; width: 150px;">FS</th>
<th class="style3" style="height: 7px; width: 33px;">Departure</th>
<th class="style3" style="height: 7px; width: 31px;">Arrival</th>
<th class="style3" style="height: 7px; width: 31px;">Status</th>
<th class="style3" style="height: 7px; width: 9px;">Aircraft</th>
<th class="style3" style="height: 7px; width: 31px;">Online</th>
</tr>
</thead>
<tbody>
CODE_HTML;
/**
* Maintenant, on boucle et on construit les lignes du tableau
*/
foreach($parsed_json->aaData as $i => $aaData)
{
$server = $aaData->server;
$callsign = $aaData->callsign;
$realname = $aaData->realname;
$fstype = $aaData->fstype;
$planned_depairport = $aaData->planned_depairport;
$planned_destairport = $aaData->planned_destairport;
$planned_aircraft = $aaData->planned_aircraft;
$plane_onground = $aaData->plane_onground;
$time_connected = $aaData->time_connected;
/**
* Construction des lignes du tableau
*/
$sTableau .= <<<CODE_HTML
<tr>
<td class="style40" style="height: 9px; width: 9px;">{$server}</td>
<td class="style40" style="height: 9px; width: 9px;">{$callsign}</td>
<td class="style40" style="height: 9px; width: 9px;">{$realname}</td>
<td class="style40" style="height: 9px; width: 9px;">{$fstype}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_depairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_destairport}</td>
<td class="style40" style="height: 9px; width: 9px;">{$planned_aircraft}</td>
<td class="style40" style="height: 9px; width: 9px;">{$plane_onground}</td>
<td class="style40" style="height: 9px; width: 9px;">{$time_connected}</td>
</tr>
CODE_HTML;
}
/**
* Fermeture du tableau HTML
*/
$sTableau .= <<<CODE_HTML
</tbody>
</table>
CODE_HTML;
/**
* Affichage du tableau HTML
*/
echo($sTableau);
?>
OK, ben je veux pas te décevoir, mais même si la page s'affiche, ton code est totalement invalide. Le PHP fonctionne, très bien, mais le résultat HTML est une vraie catastrophe : balises script, meta ou style n'importe où, balise body au milieu d'un tableau, c'est vraiment du grand n'importe quoi
Je te suggère de toujours commencer par une maquette HTML que tu crée avec un contenu « en dur » et que tu découpes ensuite pour les parties construites dynamiquement en PHP et tu intègres ensuite les morceau dans le bon ordre.
ok merci pour tes conseils je ne suis pas un professionnel et j'essais au mieux je débute depuis deux mois et une petite heure par jour si possible donc je prend volontiers les critiques bonne ou mauvaise pour m'améliorer.
Une fois réussi mon travail je ne manquerais pas de mettre tous sa au propre lol.
Merci pour tes conseils et ton aide
cordialement Denis