Jump to content

Recommended Posts

This is from the sample Rate.php5 code that I have received from fedex. I have input my fields so that I can get the information they need, to them. I will show you where I include it in to my file, the error and the php file that is being included.

 

My include

include ('Rate.php5');

 

Error

Parse error: parse error, unexpected T_DNUMBER, expecting ')' in /home/virtual/site130/fst/var/www/html/Rate.php5 on line 42

 

Rate.php5

<?php

// Copyright 2007, FedEx Corporation. All rights reserved.
// Version 2.0.0

chdir('..'); 

require_once('library/fedex-common.php5');

$newline = "<br />";
ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient('wsdl/RateService_v2.wsdl', array('trace' => 1)); // replace with valid path to WSDL

$request['WebAuthenticationDetail'] = array('UserCredential' =>
                                      array('Key' => 'YXSO2j7gNqcJsOSs', 'Password' => 'zcuAEs7HNaI2j2Wnlaa1Nw3G2')); // Replace 'XXX' and 'YYY' with FedEx provided credentials 
$request['ClientDetail'] = array('AccountNumber' => '510087380', 'MeterNumber' => '1214194');// Replace 'XXX' with your account and meter number
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request v2 using PHP ***');
$request['Version'] = array('ServiceId' => 'crs', 'Major' => '2', 'Intermediate' => '0', Minor => '0');
$request['Origin'] = array('StreetLines' => array('6736 Cleveland Hwy'), // Origin details
                                          'City' => 'Clermont',
                                          'StateOrProvinceCode' => 'GA',
                                          'PostalCode' => '30527',
                                          'CountryCode' => 'US');
$request['Destination'] = array('StreetLines' => array('$street'), // Destination details
                                               'City' => '$city',
                                               'StateOrProvinceCode' => '$state',
                                               'PostalCode' => '$zip',
                                               'CountryCode' => 'US');
$request['Payment'] = array('PaymentType' => 'THIRD_PARTY'); // valid codes RECIPIENT, SENDER and THIRD_PARTY
$request['DropoffType'] = 'REGULAR_PICKUP'; // valid codes BUSINESS_SERVICE_CENTER, DROP_BOX, REGULAR_PICKUP, REQUEST_COURIER and STATION
$request['ServiceType'] = 'FEDEX_GROUND'; // valid codes STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['PackagingType'] = 'YOUR_PACKAGING'; // valid codes FEDEX_BOK, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['ShipDate'] = date('Y-m-d');
$request['RateRequestTypes'] = 'ACCOUNT'; // valid codes ACCOUNT, LIST
       
$PassRateRequestPackageSummary = true;

if ($PassRateRequestPackageSummary)
{
   // Passing multi piece shipment rate request (by setting PieceCount > 1)
   $request['RateRequestPackageSummary'] = array('TotalWeight' => array('Value' => $weight.0, 'Units' => 'LB'), // valid codes LB and KG
                                                                'TotalInsuredValue' => array('Amount' => $total, 'Currency' => 'USD'),
                                                                'PieceCount' => $quan,
}
else
{
    // Passing single piece shipment rate request 
    $request['PackageCount'] = 1; // currently only one occurrence of RequestedPackage is supported
    $request['Packages'] = array(0 => array('Weight' => array('Value' => $weight.0, 'Units' => 'LB'), // valid code LB and KG
                                                           'InsuredValue' => array('Amount' => $total, 'Currency' => 'USD'),
}

try 
{
    $response = $client ->__soapCall("getRate", array('parameters' => $request));
        
    if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR')
    {
        printRequestResponse($client);
    }
    else
    {
        echo 'Error in processing transaction.'. $newline. $newline; 
        foreach ($response -> Notifications as $notification)
        {           
            if(is_array($response -> Notifications))
            {              
               echo $notification -> Severity;
               echo ': ';           
               echo $notification -> Message . $newline;
            }
            else
            {
                echo $notification . $newline;
            }
        } 
    } 
    
    writeToLog($client);    // Write to log file   

} catch (SoapFault $exception) {
   printFault($exception, $client);        
}

?>

Link to comment
https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/
Share on other sites

Did you look at the line?  no semi colon at the end, and it has a comma like something was deleted.

 

$request['RateRequestPackageSummary'] = array('TotalWeight' => array('Value' => $weight.0, 'Units' => 'LB'), // valid codes LB and KG
                                                                'TotalInsuredValue' => array('Amount' => $total, 'Currency' => 'USD'),
                                                                'PieceCount' => $quan,

That seems to be in more areas as well.

 

You got a "$weight.0" value on line 42.

 

In the future, tell members what line is 42 exactly.

 

Also, if you didn't write the script, post it in third party script topic area.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.