Example #1
0
 /**
  * Creates a booking for pickup.
  *
  * return array
  */
 public function getResponse()
 {
     // initialize SOAP client
     $client = new SoapClient($this->_url, array());
     $funcs = $client->__getFunctions();
     // initialize SOAP header
     $headerbody = array(self::USER_TOKEN => $this->_userToken);
     $header = new SoapHeader($this->_header, self::AUTH_HEADER, $headerbody);
     $client->__setSoapHeaders($header);
     // prepare parameters
     $param = array(self::BOOKING_DATE => $this->_date, self::REFERENCE_NUMBER => $this->_addressRefNo, self::REMARKS => $this->_remarks);
     // execute SOAP method
     try {
         $result = $client->Schedule($param);
     } 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;
 }