Php 联邦快递是否提供折扣运费?
有人帮我找到使用联邦快递api的收费服务吗?我有3个文件用于查找费率服务 我从这里下载了这三个文件。当我运行RateWebServiceClient.php时,它会显示一个错误: 事务返回了一个错误。 严重性:错误 资料来源:教授 代码:1000 消息:身份验证失败 API密钥、API密码、仪表号、帐号等所有凭证均正确无误 1.fedex-common.php5 2.RateWebServiceClient.php 3.RateService_v14.wsdlPhp 联邦快递是否提供折扣运费?,php,web-services,soap,wsdl,fedex,Php,Web Services,Soap,Wsdl,Fedex,有人帮我找到使用联邦快递api的收费服务吗?我有3个文件用于查找费率服务 我从这里下载了这三个文件。当我运行RateWebServiceClient.php时,它会显示一个错误: 事务返回了一个错误。 严重性:错误 资料来源:教授 代码:1000 消息:身份验证失败 API密钥、API密码、仪表号、帐号等所有凭证均正确无误 1.fedex-common.php5 2.RateWebServiceClient.php 3.RateService_v14.wsdl require_once('fed
require_once('fedex-common.php5');
$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "RateService_v24.wsdl";
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'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' => '24',
'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();
require_once('fedex-common.php5');
$newline=“
”;
//示例代码中不包含WSDL。
//请在$path_to_wsdl变量中包含和引用。
$path\u to_wsdl=“RateService\u v24.wsdl”;
ini_集(“soap.wsdl_缓存已启用”,“0”);
$client=newsoapclient($path_to_wsdl,array('trace'=>1));
$request['WebAuthenticationDetail']=数组(
“UserCredential”=>数组(
'Key'=>getProperty('Key'),
'Password'=>getProperty('Password')
)
);
$request['ClientDetail']=数组(
'AccountNumber'=>getProperty('shipaccount'),
'MeterNumber'=>getProperty('meter')
);
$request['TransactionDetail']=array('CustomerTransactionId'=>'***使用PHP对请求进行评级***');
$request['Version']=数组(
'ServiceId'=>'crs',
“少校”=>“24”,
“中间”=>“0”,
“次要”=>“0”
);
$request['ReturnTransitAndCommit']=true;
$request['requestedshipping']['DropoffType']='REGULAR_PICKUP';//有效值定期取货,请求快递。。。
$request['requestedshipping']['shipptimestamp']=日期('c');
$request['requestedshipping']['ServiceType']='INTERNATIONAL_PRIORITY';//有效值标准夜、优先级夜、联邦快递地面。。。
$request['requestedshipping']['PackagingType']='YOUR_PACKAGING';//有效值联邦快递箱、联邦快递包装、联邦快递管、您的包装。。。
$request['RequestedShipping']['TotalInsuredValue']=数组(
“amount”=>100,
“货币”=>“美元”
);
$request['requestedshipping']['Shipper']=addShipper();
$request['requestedshipping']['Recipient']=addRecipient();
$request['requestedshipping']['ShippingChargesPayment']=addShippingChargesPayment();
$request['requestedshipping']['PackageCount']='1';
$request['requestedShipping']['RequestedPackageLineItems']=addPackageLineItem1();
请尝试此代码
<?php
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/rate/v13">';
$xml .= '<SOAP-ENV:Body>';
$xml .= '<ns1:RateRequest>';
$xml .= '<ns1:WebAuthenticationDetail>';
$xml .= '<ns1:UserCredential>';
$xml .= '<ns1:Key></ns1:Key>'; // Use your Fedex Test Key Here
$xml .= '<ns1:Password></ns1:Password>'; //// Use your Fedex Test Password Here
$xml .= '</ns1:UserCredential>';
$xml .= '</ns1:WebAuthenticationDetail>';
$xml .= '<ns1:ClientDetail>';
$xml .= '<ns1:AccountNumber></ns1:AccountNumber>';
$xml .= '<ns1:MeterNumber></ns1:MeterNumber>';
$xml .= '</ns1:ClientDetail>';
$xml .= '<ns1:TransactionDetail>';
$xml .= '<ns1:CustomerTransactionId> *** Rate Request v13 using PHP ***</ns1:CustomerTransactionId>';
$xml .= '</ns1:TransactionDetail>';
$xml .= '<ns1:Version>';
$xml .= '<ns1:ServiceId>crs</ns1:ServiceId>';
$xml .= '<ns1:Major>13</ns1:Major>';
$xml .= '<ns1:Intermediate>0</ns1:Intermediate>';
$xml .= '<ns1:Minor>0</ns1:Minor>';
$xml .= '</ns1:Version>';
$xml .= '<ns1:ReturnTransitAndCommit>true</ns1:ReturnTransitAndCommit>';
$xml .= '<ns1:RequestedShipment>';
$xml .= '<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>';
$xml .= '<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>';
$xml .= '<ns1:TotalInsuredValue>';
$xml .= '<ns1:Currency>USD</ns1:Currency>';
$xml .= '</ns1:TotalInsuredValue>';
$xml .= '<ns1:Shipper>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Shipper Test Address</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Sample Company</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>800-5435-6789</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>1300 Basswood Road</ns1:StreetLines>';
$xml .= '<ns1:City></ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>IL</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>60173</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Shipper>';
$xml .= '<ns1:Recipient>';
$xml .= '<ns1:Contact>';
$xml .= '<ns1:PersonName>Harish</ns1:PersonName>';
$xml .= '<ns1:CompanyName>Test</ns1:CompanyName>';
$xml .= '<ns1:PhoneNumber>98656789130</ns1:PhoneNumber>';
$xml .= '</ns1:Contact>';
$xml .= '<ns1:Address>';
$xml .= '<ns1:StreetLines>32 wall street albany</ns1:StreetLines>';
$xml .= '<ns1:City>Atlanta</ns1:City>';
$xml .= '<ns1:StateOrProvinceCode>GA</ns1:StateOrProvinceCode>';
$xml .= '<ns1:PostalCode>30318</ns1:PostalCode>';
$xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
$xml .= '<ns1:Residential>true</ns1:Residential>';
$xml .= '</ns1:Address>';
$xml .= '</ns1:Recipient>';
$xml .= '<ns1:ShippingChargesPayment>';
$xml .= '<ns1:PaymentType>SENDER</ns1:PaymentType>';
$xml .= '<ns1:Payor>';
$xml .= '<ns1:ResponsibleParty>';
$xml .= '<ns1:AccountNumber>510087100</ns1:AccountNumber>';
$xml .= '</ns1:ResponsibleParty>';
$xml .= '</ns1:Payor>';
$xml .= '</ns1:ShippingChargesPayment>';
$xml .= '<ns1:RateRequestTypes>LIST</ns1:RateRequestTypes>';
$xml .= '<ns1:PackageCount>1</ns1:PackageCount>';
$xml .= '<ns1:RequestedPackageLineItems>';
$xml .= '<ns1:SequenceNumber>1</ns1:SequenceNumber>';
$xml .= '<ns1:GroupPackageCount>1</ns1:GroupPackageCount>';
$xml .= '<ns1:Weight>';
$xml .= '<ns1:Units>LB</ns1:Units>';
$xml .= '<ns1:Value>45</ns1:Value>';
$xml .= '</ns1:Weight>';
$xml .= '<ns1:Dimensions>';
$xml .= '<ns1:Length>12</ns1:Length>';
$xml .= '<ns1:Width>9</ns1:Width>';
$xml .= '<ns1:Height>8</ns1:Height>';
$xml .= '<ns1:Units>IN</ns1:Units>';
$xml .= '</ns1:Dimensions>';
$xml .= '</ns1:RequestedPackageLineItems>';
$xml .= '</ns1:RequestedShipment>';
$xml .= '</ns1:RateRequest>';
$xml .= '</SOAP-ENV:Body>';
$xml .= '</SOAP-ENV:Envelope>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://wsbeta.fedex.com:443/web-services');
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$result_xml = curl_exec($ch);
$result_xml = str_replace(array(':','-'), '', $result_xml);
$result = @simplexml_load_string($result_xml);
echo "<pre>";
print_r($result);
echo "</pre>";
?>
似乎有更多的人有这个问题。最肯定的是,他们已经改变了自己的某些方面。没有可用的支持吗?