26 lines
1018 B
PHP
Executable File
26 lines
1018 B
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
class MondialRelayWebAPI {
|
|
private $_APIEndPointUrl;
|
|
private $_APILogin;
|
|
private $_APIPassword;
|
|
private $_MRConnectUrl = "http://connect.mondialrelay.com";
|
|
private $_Debug = false;
|
|
|
|
public function __construct($ApiEndPointUrl, $ApiLogin, $ApiPassword ) {
|
|
$this->_APILogin = $ApiLogin ;
|
|
$this->_APIPassword = $ApiPassword ;
|
|
}
|
|
|
|
public function GetShipmentConnectTracingLink($ShipmentNumber,$UserLogin) {
|
|
$Tracing_url = "/".trim(strtoupper($this->_APILogin)). "/Expedition/Afficher?numeroExpedition=" .$ShipmentNumber;
|
|
return $this->_MRConnectUrl .$this->AddConnectSecurityParameters($Tracing_url,$UserLogin);
|
|
}
|
|
|
|
private function AddConnectSecurityParameters($UrlToSecure, $UserLogin) {
|
|
$UrlToSecure = $UrlToSecure. "&login=" .$UserLogin. "&ts=".time();
|
|
$UrlToEncode = $this->_APIPassword. "_" .$UrlToSecure ;
|
|
return $UrlToSecure. "&crc=".strtoupper(md5($UrlToEncode));
|
|
}
|
|
}
|
|
?>
|