Example #1
0
 /**
  * Retrieving tracking information given the waybill number of the
  * shipment.
  *
  * @return array
  */
 public function getTracking()
 {
     // initialize SOAP client
     $client = new SoapClient(self::TRACKING_WSDL, array());
     $funcs = $client->__getFunctions();
     // initialize SOAP header
     $headerbody = array(self::USER_TOKEN => $this->_userToken);
     $header = new SoapHeader(self::HEADER, self::AUTH_HEADER, $headerbody);
     $client->__setSoapHeaders($header);
     // prepare parameters
     $query = array(self::WAY_BILL_NO => $this->_wayBillNo);
     // execute SOAP method
     try {
         $result = $client->GetList($query);
         //catch soap fault
     } catch (SoapFault $soapfault) {
         $this->_exceptionFlag = true;
         $exception = $soapfault->getMessage();
         preg_match_all('/: (.*?). at/s', $exception, $error, PREG_SET_ORDER);
         //Print error
         return $error[0][1];
     }
     return $result;
 }