[ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ], 'http' => [ 'method' => 'POST', 'header' => "Content-Type: text/xml; charset=utf-8\r\n", 'timeout' => 30 ] ]); $options = [ 'location' => 'https://api.mondialrelay.com/Web_Services.asmx', 'uri' => 'http://www.mondialrelay.fr/webservice/', 'trace' => true, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'stream_context' => $context, 'user_agent' => 'PHP-SOAP/' . phpversion() ]; try { $client = new SoapClient($localWsdl, $options); $client->__setSoapHeaders(new SoapHeader( 'http://www.mondialrelay.fr/webservice/', 'SOAPAction', 'http://www.mondialrelay.fr/webservice/WSI4_PointRelais_Recherche' )); $params = [ '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', ]; $params['Security'] = strtoupper(md5(implode('', $params) . $MR_WebSiteKey)); $result = $client->__soapCall('WSI4_PointRelais_Recherche', [$params]); // echo "
";
    // echo "SUCCÈS ! Voici les points relais :\n\n";
    // print_r($result);
    // echo "
"; } catch (SoapFault $e) { echo "
";
    echo "Erreur SOAP : " . $e->getMessage() . "\n\n";
    echo "Request:\n" . htmlspecialchars($client->__getLastRequest()) . "\n\n";
    echo "Response:\n" . htmlspecialchars($client->__getLastResponse());
    echo "
"; } // === AFFICHAGE DES POINTS RELAIS (compatible WSI4) === $myVar = '
Liste des points relais à 20km
'; if (!isset($result->WSI4_PointRelais_RechercheResult->PointsRelais->PointRelais_Details)) { echo "

Aucun point relais trouvé.

"; return; } $liste = $result->WSI4_PointRelais_RechercheResult->PointsRelais->PointRelais_Details; // Si un seul point relais → on le met dans un tableau if (isset($liste->Num)) { $liste = [$liste]; } $a = 0; foreach ($liste as $pr) { $a++; if ($a == 3) $a = 1; $Num = $pr->Num ?? ''; $LgAdr1 = $pr->LgAdr1 ?? ''; $LgAdr2 = $pr->LgAdr2 ?? ''; $LgAdr3 = $pr->LgAdr3 ?? ''; $LgAdr4 = $pr->LgAdr4 ?? ''; $CP = $pr->CP ?? ''; $Ville = $pr->Ville ?? ''; $Pays = $pr->Pays ?? ''; $Localisation1 = $pr->Localisation1 ?? ''; $Distance = $pr->Distance ?? ''; $URL_Photo = $pr->URL_Photo ?? ''; $myVar .= '
'; // Photo + Nom + Adresse principale if ($URL_Photo) { // $myVar .= ''; // On force le passage par notre proxy maison $proxyUrl = str_replace( 'https://ww2.mondialrelay.com', '/mr-photo', // ← ton chemin proxy $URL_Photo ); $myVar .= ''; } $myVar .= '• ' . htmlspecialchars($LgAdr1) . '
'; // Adresses secondaires foreach ([$LgAdr2, $LgAdr3, $LgAdr4] as $adr) { if ($adr) { $myVar .= '' . htmlspecialchars($adr) . '
'; } } // CP + Ville $myVar .= '' . htmlspecialchars($CP) . ' ' . htmlspecialchars($Ville) . '
'; // Localisation + Distance if ($Localisation1) { $myVar .= '' . htmlspecialchars($Localisation1) . '
'; } if ($Distance) { $myVar .= '≈ ' . round($Distance/1000, 1) . ' km
'; } // Horaires (uniquement les jours avec ouverture) $jours = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']; $horairesAffiches = false; foreach ($jours as $jour) { $champ = 'Horaires_' . $jour; if (isset($pr->$champ->string) && is_array($pr->$champ->string)) { $h = $pr->$champ->string; if (count($h) >= 2 && $h[0] && $h[1]) { $ouvert = substr($h[0], 0, 2) . 'h' . substr($h[0], 2) . ' - ' . substr($h[1], 0, 2) . 'h' . substr($h[1], 2); $myVar .= '' . $jour . ' : ' . $ouvert . '
'; $horairesAffiches = true; } } } if (!$horairesAffiches) { $myVar .= 'Horaires non disponibles
'; } // Bouton radio $checked = (!empty($idPointRelais) && $idPointRelais == $Num) ? 'checked' : ''; $myVar .= '
'; $myVar .= ''; $myVar .= '
'; } echo $myVar; ?>