Bonjour a tous
C mon premier post sur votre forum que je l'admire trop, car il m'a aider siuvent a résoudre quelques problèmes en php.
bref , je me coince depuis quelques temps dans la création d'un service web pour Chronopost mais comme je suis newbee en php j'arrive pas a achever cette tâche tous seul. C'est pour cela je compte sur vos gentilles âmes pour m'aider.
j'ai trouvé des exemples du service wsdl de la bibliothèque nusoap mais je ne sais pas comment les modifies pour avoir une liste des point relais du Chronopost.j'ai trouvé le service web pour mondial relay qui ressemble a celui que je cherche mais qui est un peu compliqué pour moi.
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| <?php
include(dirname(__FILE__).'/../mondial_relay.php');
$mondial_relay = new mondial_relay();
DEFINE('_Enseigne_webservice',$mondial_relay->get_conf('mr_Enseigne_WebService'));
DEFINE('_Key_webservice',$mondial_relay->get_conf('mr_Key_WebService'));
header('Content-Type: text/html; charset=utf-8');
$relativ_base_dir=$_POST['relativ_base_dir'];
$client_pays_iso=$_POST['Pays'];
$client_ville=$_POST['Ville'];
$client_cp=$_POST['CP'];
$card_taille=$_POST['Taille'];
$card_weight=$_POST['Poids'];
$client_type_exp=$_POST['Action'];
$k_security=strtoupper(md5(_Enseigne_webservice.$client_pays_iso.$client_ville.$client_cp.$card_taille.$card_weight.$client_type_exp._Key_webservice));
require_once('tools/nusoap/lib/nusoap.php');
$client_mr = new nusoap_client("http://www.mondialrelay.fr/webservice/Web_Services.asmx?WSDL",true);
$client_mr->soap_defencoding = 'UTF-8';
$client_mr->decode_utf8 = false;
$params = array(
'Enseigne' => _Enseigne_webservice,
'Pays' => $client_pays_iso,
'Ville' => $client_ville,
'CP' => $client_cp,
'Taille' => '',
'Poids' => $card_weight,
'Action' => $client_type_exp,
'Security' => $k_security,
);
$result_mr = $client_mr->call('WSI2_RecherchePointRelais', $params, 'http://www.mondialrelay.fr/webservice/', 'http://www.mondialrelay.fr/webservice/WSI2_RecherchePointRelais');
if ($client_mr->fault)
{
echo 'a|<h2>Fault (Expect - The request contains an invalid SOAP body)</h2><pre>';
print_r($result);
echo '</pre>';
} else
{
$err = $client_mr->getError();
if ($err) { echo 'a|<h2>Error</h2><pre>' . $err . '</pre>'; }
else
{
$tr="";
echo $result_mr['WSI2_RecherchePointRelaisResult']['STAT'].'|';
for ($i=1;$i<=10;$i++)
{
if($i<10) {$l='0'.$i;} else {$l='10';};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']!='' || $result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']!=null)
{
$tr.="<tr style='border:none;'>";
$tr.="<td valign=top style='border:none;'><img src=\"".$relativ_base_dir."modules/mondial_relay/kit_mondial_relay/MR_small.gif\"></td>";
$tr.="<td style='border:none;;vertical-align:middle'><strong>".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr1']."</strong>";
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr2']!='') {$tr.=" - ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr2'];};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr3']!='') {$tr.=" - ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr3'];};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr4']!='') {$tr.=" - ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr4'];};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['CP']!='') {$tr.=" - ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['CP'];};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Ville']!='') {$tr.=" ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Ville'];};
if ($result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Pays']!='') {$tr.=" - ".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Pays'];};
$tr.="<input id=\"MR_Num_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_Num_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" type=\"hidden\">
<input id=\"MR_LgAdr1_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_LgAdr1_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr1']."\" type=\"hidden\">
<input id=\"MR_LgAdr2_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_LgAdr2_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr2']."\" type=\"hidden\">
<input id=\"MR_LgAdr3_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_LgAdr3_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr3']."\" type=\"hidden\">
<input id=\"MR_LgAdr4_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_LgAdr4_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['LgAdr4']."\" type=\"hidden\">
<input id=\"MR_CP_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_CP_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['CP']."\" type=\"hidden\">
<input id=\"MR_Ville_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_Ville_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Ville']."\" type=\"hidden\">
<input id=\"MR_Pays_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MR_Pays_".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" value=\"".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Pays']."\" type=\"hidden\">";
$tr.="</td>";
$tr.="<td valign=top style='border:none;'><a href=\"javascript:void(0)\" onclick=\"recherche_MR_detail('".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."','".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Pays']."')\"><img src=\"".$relativ_base_dir."modules/mondial_relay/kit_mondial_relay/loupe.gif\" border=\"0\"></a></td>";
$tr.="<td style=\"border:none;vertical-align:middle\"><input id=\"MRchoixRelais".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" name=\"MRchoixRelais\" value=\"MR".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."\" ".$checked." onclick=\"select_PR_MR('".$result_mr['WSI2_RecherchePointRelaisResult']['PR'.$l]['Num']."')\" type=\"radio\"> </td>";
$tr.="</tr>";
};
};
echo "<div style='z-index:9998;cursor: wait;position:absolute; top:0; left:0; height:100%; width:100%;display:none;
background-color:#cccccc;-moz-opacity:0.8; opacity:0.8; filter:alpha(opacity=80); -khtml-opacity:0.8;' id='bg_detail_md'></div>
<div id='detail_md' style='position: absolute;
background-color:#ffffff;
float:left;
width:740px;
height:480px;
border:1px solid #89a;
overflow:none;
text-align:left;
z-index:9999;
display:none;'></div>
<table style='border:none;'>".$tr."</table>";
}
}
?> |
je cherche a récupérer les point relais "RECHERCHEBTPARCODEPRODUITETCODEPOSTALETDATE " du Chronopost.
merci d'avance