Esempio n. 1
0
// Copyright 2009, FedEx Corporation. All rights reserved.
// Version 12.0.0
require_once '../../../library/fedex-common.php';
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "../../../wsdl/beta/ShipService_v17.wsdl";
define('SHIP_LABEL', 'shipexpresslabel.pdf');
// PDF label file. Change to file-extension .pdf for creating a PDF label (e.g. shiplabel.pdf)
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('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password')));
$request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter'));
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Express International Shipping Request using PHP ***');
$request['Version'] = array('ServiceId' => 'ship', 'Major' => '17', 'Intermediate' => '0', 'Minor' => '0');
$request['RequestedShipment'] = array('ShipTimestamp' => date('c'), 'DropoffType' => 'REGULAR_PICKUP', 'ServiceType' => 'INTERNATIONAL_PRIORITY', 'PackagingType' => 'YOUR_PACKAGING', 'Shipper' => addShipper(), 'Recipient' => addRecipient(), 'ShippingChargesPayment' => addShippingChargesPayment(), 'CustomsClearanceDetail' => addCustomClearanceDetail(), 'LabelSpecification' => addLabelSpecification(), 'CustomerSpecifiedDetail' => array('MaskedData' => 'SHIPPER_ACCOUNT_NUMBER'), 'PackageCount' => 1, 'RequestedPackageLineItems' => array('0' => addPackageLineItem1()), 'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => 'TC007_07_PT1_ST01_PK01_SNDUS_RCPCA_POS')));
try {
    if (setEndpoint('changeEndpoint')) {
        $newLocation = $client->__setLocation(setEndpoint('endpoint'));
    }
    $response = $client->processShipment($request);
    // FedEx web service invocation
    if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
        printSuccess($client, $response);
        // Create PNG or PDF label
        // Set LabelSpecification.ImageType to 'PDF' for generating a PDF label
        $fp = fopen(SHIP_LABEL, 'wb');
        fwrite($fp, $response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image);
        fclose($fp);
        echo 'Label <a href="./' . SHIP_LABEL . '">' . SHIP_LABEL . '</a> was generated.';
    } else {
Esempio n. 2
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('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password')));
$request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter'));
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '18', 'Intermediate' => '0', 'Minor' => '0');
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP';
// valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY';
// valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
// valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue'] = array('Ammount' => 100, 'Currency' => 'USD');
$request['RequestedShipment']['Shipper'] = addShipper();
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();
try {
    if (setEndpoint('changeEndpoint')) {
        $newLocation = $client->__setLocation(setEndpoint('endpoint'));
    }
    $response = $client->getRates($request);
    if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
        $rateReply = $response->RateReplyDetails;
        echo '<table border="1">';
        echo '<tr><td>Service Type</td><td>Amount</td><td>Delivery Date</td></tr><tr>';
        $serviceType = '<td>' . $rateReply->ServiceType . '</td>';
        if ($rateReply->RatedShipmentDetails && is_array($rateReply->RatedShipmentDetails)) {
Esempio n. 3
0
	    	'AccountNumber' => getProperty('shipaccount'), 
	    	'MeterNumber' => getProperty('meter')
	    );
	    $childRequest['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground Domestic MPS Shipping Request - Child using PHP ***');
	    $childRequest['Version'] = array(
	    	'ServiceId' => 'ship', 
	    	'Major' => '17', 
	    	'Intermediate' => '0', 
	    	'Minor' => '0'
	    );
	    $childRequest['RequestedShipment'] = array(
	    	'ShipTimestamp' => date('c'),
			'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
			'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
			'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
			'Shipper' => addShipper(),
			'Recipient' => addRecipient(),
			'ShippingChargesPayment' => addShippingChargesPayment(),
			'LabelSpecification' => addLabelSpecification(), 
			'MasterTrackingId' => $masterResponse->CompletedShipmentDetail->MasterTrackingId,
			'RateRequestTypes' => array('ACCOUNT', 'LIST'), // valid values ACCOUNT and LIST
			'PackageCount' => 2,
			'RequestedPackageLineItems' => array(
				'0' => addPackageLineItem2()
			)
	    );                                                                                                                                                                                                                                                                
	    $childResponse = $client->processShipment($childRequest); // FedEx web service invocation  
	    
	    writeToLog($client);    // Write to log file
	    
	    if ($childResponse->HighestSeverity != 'FAILURE' && $childResponse->HighestSeverity != 'ERROR'){
Esempio n. 4
0
 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('ParentCredential' => array('Key' => getProperty('parentkey'), 'Password' => getProperty('parentpassword')), 'UserCredential' => array('Key' => getProperty('key'), 'Password' => getProperty('password')));
 $request['ClientDetail'] = array('AccountNumber' => getProperty('shipaccount'), 'MeterNumber' => getProperty('meter'));
 $request['TransactionDetail'] = array('CustomerTransactionId' => ' *** SmartPost Rate Request using PHP ***');
 $request['Version'] = array('ServiceId' => 'crs', 'Major' => '18', 'Intermediate' => '0', 'Minor' => '0');
 $request['ReturnTransitAndCommit'] = true;
 $request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP';
 // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
 $request['RequestedShipment']['ShipTimestamp'] = date('c');
 $request['RequestedShipment']['ServiceType'] = $_POST['ServiceType'];
 // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
 $request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING';
 // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
 $request['RequestedShipment']['Shipper'] = addShipper($_POST);
 $request['RequestedShipment']['Recipient'] = addRecipient($_POST);
 $request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment($_POST);
 $request['RequestedShipment']['SmartPostDetail'] = addSmartPostDetail($_POST);
 $request['RequestedShipment']['PackageCount'] = '1';
 $request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem($_POST);
 try {
     if (setEndpoint('changeEndpoint')) {
         $newLocation = $client->__setLocation(setEndpoint('endpoint'));
     }
     $response = $client->getRates($request);
     if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR') {
         $rateReply = $response->RateReplyDetails;
         echo '<table border="1">';
         echo '<tr><td>Service Type</td><td>Amount</td><td>Transit Time</td><td>Max Transit Time</td><td>Ship</td></tr><tr>';
         $serviceType = '<td>' . $rateReply->ServiceType . '</td>';