当前位置: 首页>>代码示例>>PHP>>正文


PHP SoapClient::track方法代码示例

本文整理汇总了PHP中SoapClient::track方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::track方法的具体用法?PHP SoapClient::track怎么用?PHP SoapClient::track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SoapClient的用法示例。


在下文中一共展示了SoapClient::track方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: track

 public function track($trackingNumber)
 {
     if (!isset($trackingNumber)) {
         return false;
     }
     //The WSDL is not included with the sample code.
     //Please include and reference in $path_to_wsdl variable.
     $path_to_wsdl = __DIR__ . DIRECTORY_SEPARATOR . 'TrackService_v9.wsdl';
     ini_set("soap.wsdl_cache_enabled", "0");
     $client = new \SoapClient($path_to_wsdl, array('trace' => 1));
     // Refer to http://us3.php.net/manual/en/ref.soap.php for more information
     $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $this->authKey, 'Password' => $this->authPassword));
     $request['ClientDetail'] = array('AccountNumber' => $this->authAccountNumber, 'MeterNumber' => $this->authMeterNumber);
     $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Track Request using PHP ***');
     $request['Version'] = array('ServiceId' => 'trck', 'Major' => '9', 'Intermediate' => '1', 'Minor' => '0');
     $request['SelectionDetails'] = array('PackageIdentifier' => array('Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => $trackingNumber));
     try {
         if ($this->setEndpoint('changeEndpoint')) {
             $newLocation = $client->__setLocation(setEndpoint('endpoint'));
         }
         $response = $client->track($request);
         $this->responseToArray($response);
         return $response;
     } catch (SoapFault $exception) {
         $this->printFault($exception, $client);
     }
 }
开发者ID:previewict,项目名称:phpie,代码行数:27,代码来源:Track.php

示例2: array

	'PackageIdentifier' => array(
		
		'Type' => 'CUSTOMER_REFERENCE',
		'Value' => getProperty('customerreference') // Replace with a valid customer reference
	),
	'ShipmentAccountNumber' => getProperty('trackaccount') // Replace with account used for shipment
);



try {
	if(setEndpoint('changeEndpoint')){
		$newLocation = $client->__setLocation(setEndpoint('endpoint'));
	}
	
	$response = $client ->track($request);

    if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){
		if($response->HighestSeverity != 'SUCCESS'){
			echo '<table border="1">';
			echo '<tr><th>Track Reply</th><th>&nbsp;</th></tr>';
			trackDetails($response->Notifications, '');
			echo '</table>';
		}else{
	    	if ($response->CompletedTrackDetails->HighestSeverity != 'SUCCESS'){
				echo '<table border="1">';
			    echo '<tr><th>Shipment Level Tracking Details</th><th>&nbsp;</th></tr>';
			    trackDetails($response->CompletedTrackDetails, '');
				echo '</table>';
			}else{
				echo '<table border="1">';
开发者ID:To-mos,项目名称:trakit,代码行数:31,代码来源:TrackWebServiceClient.php5

示例3: getTrackReply

 /**
  * Sends the TrackRequest and returns the response
  *
  * @param ComplexType\TrackRequest $trackRequest 
  * @return stdClass
  */
 public function getTrackReply(ComplexType\TrackRequest $trackRequest)
 {
     return $this->_soapClient->track($trackRequest->toArray());
 }
开发者ID:allansun,项目名称:php-fedex-api-wrapper,代码行数:10,代码来源:Request.php

示例4: trackFedexShippment

 public function trackFedexShippment()
 {
     //****************
     /* @Description: To get FEDEX tracking detials
     			/* @parameter:   
     			/* @return :  
     			****************/
     global $G_fedexcredentials;
     $fedex_track_no = trim($_REQUEST['trackno']);
     $track_userid = trim($_REQUEST['userid']);
     if (!empty($G_fedexcredentials['key']) && !empty($G_fedexcredentials['password']) && !empty($G_fedexcredentials['shipaccount']) && !empty($G_fedexcredentials['meter'])) {
         $path_to_wsdl = "fedex/TrackService_v9.wsdl";
         $client = new SoapClient($path_to_wsdl, array('trace' => 1));
         $request['WebAuthenticationDetail'] = array('UserCredential' => array('Key' => $G_fedexcredentials['key'], 'Password' => $G_fedexcredentials['password']));
         $request['ClientDetail'] = array('AccountNumber' => $G_fedexcredentials['shipaccount'], 'MeterNumber' => $G_fedexcredentials['meter']);
         //$request['TransactionDetail'] = array('CustomerTransactionId' => 'Track By Number_v9');
         $request['Version'] = array('ServiceId' => 'trck', 'Major' => '9', 'Intermediate' => '1', 'Minor' => '0');
         $request['SelectionDetails'] = array('PackageIdentifier' => 'FDXE', 'PackageIdentifier' => array('Type' => 'TRACKING_NUMBER_OR_DOORTAG', 'Value' => trim($_REQUEST['trackno'])));
         try {
             $response = $client->track($request);
             // print_r($response);
             if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
                 if (!empty($response->CompletedTrackDetails->TrackDetails->StatusDetail)) {
                     if ($response->CompletedTrackDetails->TrackDetails->Notification->Severity == 'SUCCESS') {
                         $return_arr['error_code'] = 0;
                         $track_data['userid'] = trim($_REQUEST['userid']);
                         $description = $response->CompletedTrackDetails->TrackDetails->StatusDetail->Description;
                         $desitnation_address = $response->CompletedTrackDetails->TrackDetails->DestinationAddress;
                         $delivery_address = $response->CompletedTrackDetails->TrackDetails->ActualDeliveryAddress;
                         $track_data['trackno'] = $response->CompletedTrackDetails->TrackDetails->TrackingNumber;
                         $service = $response->CompletedTrackDetails->TrackDetails->Service->Description;
                         if (!empty($response->CompletedTrackDetails->TrackDetails->PackageWeight->Value)) {
                             $package_weight = sprintf('%s %s', $response->CompletedTrackDetails->TrackDetails->PackageWeight->Value, $response->CompletedTrackDetails->TrackDetails->PackageWeight->Units);
                         } else {
                             $package_weight = 'N/A';
                         }
                         if (!empty($response->CompletedTrackDetails->TrackDetails->PackageDimensions->Length)) {
                             $package_dimensions = sprintf('L=%s, W=%s, H=%s(%s)', $response->CompletedTrackDetails->TrackDetails->PackageDimensions->Length, $response->CompletedTrackDetails->TrackDetails->PackageDimensions->Width, $response->CompletedTrackDetails->TrackDetails->PackageDimensions->Height, $response->CompletedTrackDetails->TrackDetails->PackageDimensions->Units);
                         } else {
                             $package_dimensions = 'N/A';
                         }
                         $track_data['package_weight'] = $package_weight;
                         $track_data['package_dimensions'] = $package_dimensions;
                         $track_data['type'] = 'fedex';
                         if ($description != "") {
                             $record_status = $description;
                         } else {
                             $record_status = "pending";
                         }
                         $track_data['status'] = $record_status;
                         $track_data['service'] = $service;
                         $currentlocation = $response->CompletedTrackDetails->TrackDetails->StatusDetail->Location;
                         $track_data['arrtime'] = date('M j, Y H:i:s', strtotime($response->CompletedTrackDetails->TrackDetails->ActualDeliveryTimestamp));
                         $track_data['deptime'] = date('M j, Y H:i:s', strtotime($response->CompletedTrackDetails->TrackDetails->ShipTimestamp));
                         $final_llocatoin = $final_destadd = $final_add = '';
                         foreach ($delivery_address as $key => $address) {
                             if (!empty($address)) {
                                 $final_add .= sprintf('%s: %s, ', $key, $address);
                             }
                         }
                         foreach ($desitnation_address as $dkey => $dest) {
                             if (!empty($dest)) {
                                 $final_destadd .= sprintf('%s: %s, ', $dkey, $dest);
                             }
                         }
                         foreach ($currentlocation as $lkey => $laddress) {
                             if (!empty($laddress)) {
                                 $final_llocatoin .= sprintf('%s: %s, ', $lkey, $laddress);
                             }
                         }
                         $track_data['destination'] = trim($final_destadd, ', ');
                         $track_data['devlivery'] = trim($final_add, ', ');
                         $track_data['lastlocation'] = trim($final_llocatoin, ', ');
                         $track_update_id = $this->checkTrackExists();
                         if ($track_update_id === false) {
                             $track_ins_id = $this->insertTrackStatus($track_data);
                             if ($track_ins_id !== false) {
                                 $track_data['trackid'] = $track_ins_id;
                                 $this->emailPushNotification($track_userid, $fedex_track_no, $record_status);
                             }
                         } else {
                             $track_package_name = $this->updateTrackStatus($track_data, $track_update_id);
                             $track_data['trackid'] = $track_update_id;
                             $track_data['packagename'] = $track_package_name;
                             $this->emailPushNotification($track_userid, $fedex_track_no, $record_status, $track_update_id);
                         }
                         $track_data['trackhistory'] = array();
                         $return_arr['tracklist'][] = $track_data;
                     } else {
                         $return_arr['error_code'] = 1;
                         $return_arr['error_msg'] = $response->CompletedTrackDetails->TrackDetails->Notification->Message;
                     }
                 }
             } else {
                 $return_arr['error_code'] = 1;
                 $return_arr['error_msg'] = 'FEDEX API error';
             }
         } catch (SoapFault $exception) {
             $return_arr['error_code'] = 1;
             $return_arr['error_msg'] = 'FEDEX SOAP exception arised';
//.........这里部分代码省略.........
开发者ID:premkumar-shenll,项目名称:oxygen-app,代码行数:101,代码来源:index.php

示例5: trackPackages

 function trackPackages($track_date = '0000-00-00', $log_id = false)
 {
     global $db, $messageStack;
     $result = array();
     if (MODULE_SHIPPING_FEDEX_V7_TEST_MODE == 'Test') {
         $messageStack->add('Tracking only works on the FedEx production server!', 'error');
         return false;
     } else {
         $client = new SoapClient(PATH_TO_TRACK_WSDL, array('trace' => 1));
     }
     if ($log_id) {
         $shipments = $db->Execute("select id, ref_id, deliver_date, actual_date, tracking_id, notes \n\t\t\t\tfrom " . TABLE_SHIPPING_LOG . " \n\t\t\t\twhere carrier = '" . $this->code . "' and id = '" . $log_id . "'");
     } else {
         $start_date = $track_date;
         $end_date = gen_specific_date($track_date, $day_offset = 1);
         $shipments = $db->Execute("select id, ref_id, deliver_date, actual_date, tracking_id, notes \n\t\t\t\tfrom " . TABLE_SHIPPING_LOG . " \n\t\t\t\twhere carrier = '" . $this->code . "' \n\t\t\t\t\tand ship_date >= '" . $start_date . "' and ship_date < '" . $end_date . "'");
     }
     while (!$shipments->EOF) {
         $tracking_number = $shipments->fields['tracking_id'];
         if ($shipments->fields['actual_date'] != '0000-00-00 00:00:00') {
             // skip if already tracked
             $shipments->MoveNext();
             continue;
         }
         $request = $this->FormatFedExTrackRequest($shipments->fields['tracking_id']);
         if (!$request) {
             continue;
         }
         //echo 'request = '; print_r($request); echo '<br />';
         try {
             $response = $client->track($request);
             //echo 'Request <pre>' . htmlspecialchars($client->__getLastRequest()) . '</pre>';
             //echo 'Response <pre>' . htmlspecialchars($client->__getLastResponse()) . '</pre>';
             if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
                 $actual_date = str_replace('T', ' ', $response->TrackDetails->ActualDeliveryTimestamp);
                 $actual_date = substr($actual_date, 0, -6);
                 // see if the package was late, flag if so
                 $late = '0';
                 // no data
                 if ($shipments->fields['deliver_date'] < $actual_date) {
                     $late = 'L';
                     //					  $messageStack->add(SHIPPING_FEDEX_V7_TRACK_FAIL . $shipments->fields['ref_id'], 'error');
                 } elseif ($response->TrackDetails->StatusCode != 'DL') {
                     $late = 'T';
                     $messageStack->add(sprintf(SHIPPING_FEDEX_V7_TRACK_STATUS, $shipments->fields['ref_id'], $response->TrackDetails->StatusCode, $response->TrackDetails->StatusDescription), 'caution');
                 }
                 // update the log file with the actual delivery timestamp, append notes
                 $db->Execute("update " . TABLE_SHIPPING_LOG . " \n\t\t\t\t\t  set actual_date = '" . $actual_date . "', deliver_late = '" . $late . "' where id = " . $shipments->fields['id']);
                 //					$messageStack->add(SHIPPING_FEDEX_V7_TRACK_SUCCESS . $response->TrackDetails->ActualDeliveryTimestamp, 'success');
             } else {
                 foreach ($response->Notifications as $notification) {
                     if (is_object($notification)) {
                         $message .= ' (' . $notification->Severity . ') ' . $notification->Message;
                     } else {
                         $message .= ' ' . $notification;
                     }
                 }
                 $messageStack->add(SHIPPING_FEDEX_V7_TRACK_ERROR . $message, 'error');
                 return false;
             }
         } catch (SoapFault $exception) {
             //echo 'Error Request <pre>' . htmlspecialchars($client->__getLastRequest()) . '</pre>';
             //echo 'Error Response <pre>' . htmlspecialchars($client->__getLastResponse()) . '</pre>';
             $message = " ({$exception->faultcode}) {$exception->faultstring}";
             $messageStack->add(SHIPPING_FEDEX_CURL_ERROR . $message, 'error');
             return false;
         }
         $shipments->MoveNext();
     }
     return true;
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:71,代码来源:fedex_v7.php


注:本文中的SoapClient::track方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。