aebstract Posted January 25, 2008 Share Posted January 25, 2008 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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/ Share on other sites More sharing options...
revraz Posted January 25, 2008 Share Posted January 25, 2008 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, Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/#findComment-448951 Share on other sites More sharing options...
toplay Posted January 25, 2008 Share Posted January 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/#findComment-448952 Share on other sites More sharing options...
revraz Posted January 25, 2008 Share Posted January 25, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/#findComment-448955 Share on other sites More sharing options...
aebstract Posted January 25, 2008 Author Share Posted January 25, 2008 Two spots, can I not have a $weight.0? Since I am putting in a value of "##" and adding the .0 on? Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/#findComment-448981 Share on other sites More sharing options...
toplay Posted January 25, 2008 Share Posted January 25, 2008 Lots of ways of doing it...examples: "$weight.0" (but will be considered a string value) floatval($weight) round($weight, 1) Quote Link to comment https://forums.phpfreaks.com/topic/87767-parse-error-fedex-shipping-rates-script/#findComment-449165 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.