soap_defencoding = 'utf-8'; // param SOAP $params = array( 'Enseigne' => $MR_WebSiteId, 'Pays' => "FR", 'NumPointRelais' => "", 'Ville' => $_SESSION['villeLiv'], 'CP' => $_SESSION['codePostLiv'], 'Latitude' => "", 'Longitude' => "", 'Taille' => "", 'Poids' => "", 'Action' => "", 'DelaiEnvoi' => "0", 'RayonRecherche' => "20", 'TypeActivite' => "", 'NACE' => "", 'NombreResultats' => "20", ); // On génère la clé de sécurité de l'appel $code = implode("", $params); $code .= $MR_WebSiteKey; $params["Security"] = strtoupper(md5($code)); // l'appel SOAP $result = $client->call( 'WSI4_PointRelais_Recherche', $params, 'https://api.mondialrelay.com/', 'https://api.mondialrelay.com/WSI4_PointRelais_Recherche' ); // On vérifie qu'il n'y a pas eu d'erreur if ($client->fault) { echo '

Fault (Expect - The request contains an invalid SOAP body)

';
		print_r($result);
		echo '
'; } else { $err = $client->getError(); if ($err) {echo '

Error

' . $err . '
'; } } // print_r($result); $PRelais=$result; $myVar=""; // flag traduction EDT $myVar='
Liste des points relais à 20km
'; $a=0; foreach($PRelais as $key => $value) { // print_r($value); foreach( (array)$value as $key2 => $value2) { // print_r($value2); foreach( (array)$value2 as $key3 => $value3) { // var_dump($value3); foreach( (array)$value3 as $key4 => $value4) { // Champs parasite en debut qui a pour valeur $value4[0]=0. Les champs que l'on veut eux on vide. // var_dump($value3[0]); if (isset($value3[0]['Num'])) { $a=$a+1; if ($a==3)$a=1; $myVar .= '
'; foreach( (array)$value4 as $key5 => $value5) { $trouve=false; $myVar .= ''; if ($key5=='Num') {$Num=$value5; } if ($key5=='URL_Photo') {$URL_Photo=$key5; } if ($key5=='Localisation1') {$Localisation1=$key5; } if ($key5=='Latitude') {$Latitude=$key5; } if ($key5=='Longitude') {$Longitude=$key5; } if ($key5=='Distance') {$Distance=$key5; } // if ($key5!==0 && $value5!=='' && $key5!=='Num' && $key5!=='Localisation1' && $key5!=='Longitude' && $key5!=='Latitude') { if ($key5!==0 && $value5!=='') { if (strpos( $key5, "LgAdr1")!==false) { $myVar .= "• $value5 \n
"; $trouve=true; } if ($value5=='FR') $value5='FRANCE'; // Pas besoin de libellés de champs if (strpos( $key5, "LgAdr3")!==false || strpos( $key5, "LgAdr2")!==false || strpos( $key5, "LgAdr4")!==false|| strpos( $key5, "Pays")!==false) { $myVar .= ''; $myVar .= "" .$value5. "\n
"; $myVar .= '
'; $trouve=true; } // CP pas de
: collé avec ville if (strpos( $key5, "CP")!==false) { $myVar .= ''; $myVar .= "" .$value5; $myVar .= ''; $trouve=true; } // Espace avant pour ville if (strpos( $key5, "Ville")!==false) { $myVar .= ''; $myVar .= " " .$value5. "\n
"; $myVar .= '
'; $trouve=true; } // Si horraire on affichera en 7 if (strpos( $key5, "Horaires")!==false) { $myVar .= " "; $trouve=true; } // affiche les autres champs if ($trouve==false) { // $myVar .= "$key5 : $value5 \n
"; } // $aff=1; } $trouve=false; $aff=0; $myVar .= '
'; foreach( (array)$value5 as $key6 => $value6) { if ($key6!==0 && $value6!==''&& $key6!=='string') {$myVar .= "$key6 : " .$value6. " ";} $trouve=false; foreach( (array)$value6 as $key7 => $value7) { // if ($value7!=='' && $key5!=='Distance' && $key5!=='Num' && $key5!=='Localisation1' && $key5!=='Longitude' && $key5!=='Latitude' && $key5!=='Pays' && $key5!=='Ville' && $key5!=='CP' && $key5!=='LgAdr1' && $key5!=='LgAdr2' && $key5!=='LgAdr3') { if ($value7!=='') { $myVar .= ''; if (strpos( $key5, "Horaires") !==false && $trouve==false && $value7!=0 ) { // on enleve le mot Horraire_ $myVar .= "".substr($key5,-(strlen($key5)-9)). " : ".substr($value7,0,2). "H".substr($value7,-2); // on a trouvé au moins 1 horraire $trouve=true; $aff=1; } else { if ($value7!=0 && strpos( $key5, "Horaires") !==false ) {$myVar .= " - ".substr($value7,0,2). "H".substr($value7,-2);} } if (empty($value6) && strpos( $key5, "Horaires_Lundi") !==false ) {$myVar .= "" .$key5. " : Fermé "; } $myVar .= ''; } } if ($aff==1) $myVar .= "\n
\n"; } } // Flag traduction edt if ($Num !=0 && $key5!=='' && $value7!=='' && $value6!=='' && $value5!=='' ) { if ($Num == $idPointRelais) { $myVar .= '
 Choisir ce point relais'; } else { $myVar .= '
 Choisir ce point relais'; } } $myVar .= "
"; } } } } } echo '' .$myVar. ''; // echo '

Request

' . nl2br(htmlspecialchars($client->request, ENT_QUOTES)) . ''; // echo '

Response

' . nl2br(htmlspecialchars($client->response, ENT_QUOTES)) . '
'; // echo '

Debug

' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '
'; ?>