| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 | 
							- <?php
 
- class Model_Fedex_cby extends Lin_Model {
 
- function __construct(){
 
- 		parent::__construct();
 
- }
 
- 	public function get_data($data)
 
- 	{
 
- 		$ToState = array('alabama'=>'AL','alaska'=>'AK','arizona'=>'AZ','arkansas'=>'AR','california'=>'CA','colorado'=>'CO','connecticut'=>'CT','delaware'=>'DE','florida'=>'FL','georgia'=>'GA','hawaii'=>'HI','idaho'=>'ID','illinois'=>'IL','indiana'=>'IN','iowa'=>'IA','kansas'=>'KS','kentucky'=>'KY','louisiana'=>'LA','maine'=>'ME','maryland'=>'MD','massachusetts'=>'MA','michigan'=>'MI','minnesota'=>'MN','mississippi'=>'MS','missouri'=>'MO','montana'=>'MT','nebraska'=>'NE','nevada'=>'NV','new hampshire'=>'NH','new jersey'=>'NJ','new mexico'=>'NM','new york'=>'NY','north carolina'=>'NC','north dakota'=>'ND','ohio'=>'OH','oklahoma'=>'OK','oregon'=>'OR','pennsylvania'=>'PA','rhode island'=>'RI','south carolina'=>'SC','south dakota'=>'SD','tennessee'=>'TN','texas'=>'TX','utah'=>'UT','vermont'=>'VT','virginia'=>'VA','washington'=>'WA','west virginia'=>'WV','wisconsin'=>'WI','wyoming'=>'WY','district of columbia'=>'DC','virgin islands'=>'VI');
 
- 		$data['province'] = preg_replace('/( | | |\s)/',' ',$data['province']);
 
- 		$data['province'] = trim($data['province'],' ');
 
- 		$dataprovince = strlen($data['province'])==2?$data['province']:$ToState[strtolower($data['province'])];
 
- 		$data['province'] = $dataprovince;
 
- 		//your account details here
 
- 		
 
- 		$key = 'L7Vtg0uUP0BxgNfp';
 
- 		$password = 'iOqmHwfjx12sxszdEZstGtRYs';
 
- 		$AccountNumber = '644155250';
 
- 		$MeterNumber = '250140772';
 
- 		$xml = '<?xml version="1.0" encoding="UTF-8"?>';
 
- 		$xml.='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v23="http://fedex.com/ws/ship/v23">';
 
- 		$xml.='<soapenv:Header/>';
 
- 		$xml.='<soapenv:Body>';
 
- 		$xml.='<v23:ProcessShipmentRequest>';
 
- 		$xml.='<v23:WebAuthenticationDetail>';
 
- 		$xml.='<v23:ParentCredential>';
 
- 		$xml.='<v23:Key>'.$key.'</v23:Key>';
 
- 		$xml.='<v23:Password>'.$password.'</v23:Password>';
 
- 		$xml.='</v23:ParentCredential>';
 
- 		$xml.='<v23:UserCredential>';
 
- 		$xml.='<v23:Key>'.$key.'</v23:Key>';
 
- 		$xml.='<v23:Password>'.$password.'</v23:Password>';
 
- 		$xml.='</v23:UserCredential>';
 
- 		$xml.='</v23:WebAuthenticationDetail>';
 
- 		$xml.='<v23:ClientDetail>';
 
- 		$xml.='<v23:AccountNumber>'.$AccountNumber.'</v23:AccountNumber>';
 
- 		$xml.='<v23:MeterNumber>'.$MeterNumber.'</v23:MeterNumber>';
 
- 		$xml.='</v23:ClientDetail>';
 
- 		$xml.='<v23:TransactionDetail>';
 
- 		//$xml.='<v23:CustomerTransactionId>Ship_International_basic</v23:CustomerTransactionId>';
 
- 		$xml.='</v23:TransactionDetail>';
 
- 		$xml.='<v23:Version>';
 
- 		$xml.='<v23:ServiceId>ship</v23:ServiceId>';
 
- 		$xml.='<v23:Major>23</v23:Major>';
 
- 		$xml.='<v23:Intermediate>0</v23:Intermediate>';
 
- 		$xml.='<v23:Minor>0</v23:Minor>';
 
- 		$xml.='</v23:Version>';
 
- 		$xml.='<v23:RequestedShipment>';
 
- 		$xml.='<v23:ShipTimestamp>'.date('Y-m-d',time()).'T'.date('H:i:s',time()).'-12:00'.'</v23:ShipTimestamp>';
 
- 		$xml.='<v23:DropoffType>REGULAR_PICKUP</v23:DropoffType>';
 
- 		$xml.='<v23:ServiceType>INTERNATIONAL_PRIORITY</v23:ServiceType>';//优先。INTERNATIONAL_ECONOMY经济
 
- 		//超过重量需要换包装,现在不设置,超出也按0.4走
 
- 		if($data['zzl'] < '0.5')
 
- 		{
 
- 			$xml.='<v23:PackagingType>FEDEX_PAK</v23:PackagingType>';
 
- 		}
 
- 		else
 
- 		{
 
- 			$xml.='<v23:PackagingType>FEDEX_BOX</v23:PackagingType>';
 
- 		}
 
- 		$xml.='<v23:Shipper>';//发货人信息开始
 
- 		$xml.='<v23:AccountNumber>'.$AccountNumber.'</v23:AccountNumber>';
 
- 		$xml.='<v23:Contact>';
 
- 		$xml.='<v23:PersonName>'.$data['warehouse']['company'].'</v23:PersonName>';//$data['warehouse']['company']
 
- 		$xml.='<v23:CompanyName>'.$data['warehouse']['company'].'</v23:CompanyName>';//$data['warehouse']['company']
 
- 		$xml.='<v23:PhoneNumber>'.$data['warehouse']['phone'].'</v23:PhoneNumber>';//$data['warehouse']['phone']
 
- 		//$xml.='<v23:EMailAddress>'.$data['warehouse']['name'].'</v23:EMailAddress>';
 
- 		$xml.='</v23:Contact>';
 
- 		$xml.='<v23:Address>';
 
- 		$xml.='<v23:StreetLines>4703,building C,bodi center,ningwei street</v23:StreetLines>';//$data['warehouse']['address']
 
- 		$xml.='<v23:City>'.$data['warehouse']['city'].'</v23:City>';//$data['warehouse']['city']
 
- 		//$xml.='<v23:StateOrProvinceCode>TN</v23:StateOrProvinceCode>';
 
- 		$xml.='<v23:PostalCode>450016</v23:PostalCode>';//$data['warehouse']['zipcode'] //许昌联邦要求使用郑州邮编:450016
 
- 		$xml.='<v23:CountryCode>'.$data['warehouse']['lb'].'</v23:CountryCode>';
 
- 		$xml.='</v23:Address>';
 
- 		$xml.='</v23:Shipper>';
 
- 		$xml.='<v23:Recipient>';//收货人信息开始
 
- 		$xml.='<v23:AccountNumber>'.$AccountNumber.'</v23:AccountNumber>';
 
- 		$xml.='<v23:Contact>';
 
- 		$xml.='<v23:PersonName>'.$data['name'].'</v23:PersonName>';
 
- 		$xml.='<v23:CompanyName>'.$data['name'].'</v23:CompanyName>';
 
- 		$xml.='<v23:PhoneNumber>'.$data['phone'].'</v23:PhoneNumber>';
 
- 		//$xml.='<v23:EMailAddress>'.$data['name'].'</v23:EMailAddress>';
 
- 		$xml.='</v23:Contact>';
 
- 		$xml.='<v23:Address>';
 
- 		$xml.='<v23:StreetLines>'.$data['address'].'</v23:StreetLines>';
 
- 		$xml.='<v23:StreetLines>'.$data['address2'].'</v23:StreetLines>';
 
- 		$xml.='<v23:City>'.$data['city'].'</v23:City>';
 
- 		$xml.='<v23:StateOrProvinceCode>'.$data['province'].'</v23:StateOrProvinceCode>';
 
- 		$xml.='<v23:PostalCode>'.$data['zipcode'].'</v23:PostalCode>';
 
- 		$xml.='<v23:CountryCode>'.$data['lb'].'</v23:CountryCode>';
 
- 		$xml.='</v23:Address>';
 
- 		$xml.='</v23:Recipient>';
 
- 		$xml.='<v23:ShippingChargesPayment>';
 
- 		$xml.='<v23:PaymentType>SENDER</v23:PaymentType>';
 
- 		$xml.='<v23:Payor>';
 
- 		$xml.='<v23:ResponsibleParty>';
 
- 		$xml.='<v23:AccountNumber>'.$AccountNumber.'</v23:AccountNumber>';
 
- 		$xml.='<v23:Contact>';
 
- 		$xml.='<v23:PersonName>He Cong</v23:PersonName>';
 
- 		//$xml.='<v23:EMailAddress></v23:EMailAddress>';
 
- 		$xml.='</v23:Contact>';
 
- 		$xml.='</v23:ResponsibleParty>';
 
- 		$xml.='</v23:Payor>';
 
- 		$xml.='</v23:ShippingChargesPayment>';
 
- 		//ETD开始
 
- 		$xml.='<v23:SpecialServicesRequested>';
 
- 		$xml.='<v23:SpecialServiceTypes>ELECTRONIC_TRADE_DOCUMENTS</v23:SpecialServiceTypes>';
 
- 		$xml.='<v23:EtdDetail>';
 
-         $xml.='<v23:RequestedDocumentCopies>COMMERCIAL_INVOICE</v23:RequestedDocumentCopies>';
 
-         $xml.='</v23:EtdDetail>';
 
- 		$xml.='</v23:SpecialServicesRequested>';
 
-         //ETD结束
 
- 		$xml.='<v23:CustomsClearanceDetail>';
 
- 		$xml.='<v23:DutiesPayment>';
 
- 		$xml.='<v23:PaymentType>RECIPIENT</v23:PaymentType>';
 
- 		$xml.='<v23:Payor>';
 
- 		$xml.='<v23:ResponsibleParty>';
 
- 		$xml.='<v23:AccountNumber></v23:AccountNumber>';
 
- 		//$xml.='<v23:Tins>';
 
- 		//$xml.='<v23:TinType>BUSINESS_STATE</v23:TinType>';//雇主识别代码BUSINESS_NATIONAL、BUSINESS_STATE、BUSINESS_UNION、PERSONAL_NATIONAL、PERSONAL_STATE
 
- 		//$xml.='<v23:Number>213456</v23:Number>';//这里填税号
 
- 		//$xml.='</v23:Tins>';
 
- 		//$xml.='<v23:Contact>';
 
- 		//$xml.='<v23:ContactId>12345</v23:ContactId>';
 
- 		//$xml.='<v23:PersonName>INPUT YOUR INFORMATION</v23:PersonName>';
 
- 		//$xml.='</v23:Contact>';
 
- 		$xml.='</v23:ResponsibleParty>';
 
- 		$xml.='</v23:Payor>';
 
- 		$xml.='</v23:DutiesPayment>';
 
- 		$xml.='<v23:DocumentContent>DOCUMENTS_ONLY</v23:DocumentContent>';
 
- 		$xml.='<v23:CustomsValue>';
 
- 		$xml.='<v23:Currency>USD</v23:Currency>';
 
- 		$xml.='<v23:Amount>'.$data['zsbjz'].'</v23:Amount>';
 
- 		$xml.='</v23:CustomsValue>';
 
- 		//DESC1---:Commodities循环
 
- 		$xml.='<v23:Commodities>';
 
- 		$xml.='<v23:NumberOfPieces>'.$data['zjs'].'</v23:NumberOfPieces>';//件数
 
- 		$xml.='<v23:Description>'.$data['sbpm'].' HSCODE:67041900</v23:Description>';//描述
 
- 		$xml.='<v23:CountryOfManufacture>CN</v23:CountryOfManufacture>';
 
- 		$xml.='<v23:Weight>';//需要填写重量
 
- 		$xml.='<v23:Units>KG</v23:Units>';//重量:磅
 
- 		$xml.='<v23:Value>0.4</v23:Value>';//重量填写单位为KG $data['zzl']
 
- 		$xml.='</v23:Weight>';
 
- 		$xml.='<v23:Quantity>'.$data['ts'].'</v23:Quantity>';//需要填写数量
 
- 		$xml.='<v23:QuantityUnits>cm</v23:QuantityUnits>';
 
- 		$xml.='<v23:UnitPrice>';
 
- 		$xml.='<v23:Currency>USD</v23:Currency>';
 
- 		$xml.='<v23:Amount>'.$data['dtsbjz'].'</v23:Amount>';
 
- 		$xml.='</v23:UnitPrice>';
 
- 		$xml.='</v23:Commodities>';
 
- 		/**
 
- 		//DESC2
 
- 		$xml.='<v23:Commodities>';
 
- 		$xml.='<v23:NumberOfPieces>0</v23:NumberOfPieces>';//件数
 
- 		$xml.='<v23:Description>WIGS SYNTHETIC HAIR PRODUCTS</v23:Description>';//描述
 
- 		$xml.='<v23:CountryOfManufacture>CN</v23:CountryOfManufacture>';
 
- 		$xml.='<v23:Weight>';//需要填写重量
 
- 		$xml.='<v23:Units>KG</v23:Units>';//重量:磅
 
- 		$xml.='<v23:Value>0.0001</v23:Value>';//重量填写单位为KG
 
- 		$xml.='</v23:Weight>';
 
- 		$xml.='<v23:Quantity>1</v23:Quantity>';//需要填写数量
 
- 		$xml.='<v23:QuantityUnits>cm</v23:QuantityUnits>';
 
- 		$xml.='<v23:UnitPrice>';
 
- 		$xml.='<v23:Currency>USD</v23:Currency>';
 
- 		$xml.='<v23:Amount>0</v23:Amount>';
 
- 		$xml.='</v23:UnitPrice>';
 
- 		$xml.='</v23:Commodities>';
 
- 		//DESC3
 
- 		$xml.='<v23:Commodities>';
 
- 		$xml.='<v23:NumberOfPieces>0</v23:NumberOfPieces>';//件数
 
- 		$xml.='<v23:Description>MAKE WOMEN MORE BEAUTIFUL WITH THE HAIR</v23:Description>';//描述
 
- 		$xml.='<v23:CountryOfManufacture>CN</v23:CountryOfManufacture>';
 
- 		$xml.='<v23:Weight>';//需要填写重量
 
- 		$xml.='<v23:Units>KG</v23:Units>';//重量:磅
 
- 		$xml.='<v23:Value>0.0001</v23:Value>';//重量填写单位为KG
 
- 		$xml.='</v23:Weight>';
 
- 		$xml.='<v23:Quantity>1</v23:Quantity>';//需要填写数量
 
- 		$xml.='<v23:QuantityUnits>cm</v23:QuantityUnits>';
 
- 		$xml.='<v23:UnitPrice>';
 
- 		$xml.='<v23:Currency>USD</v23:Currency>';
 
- 		$xml.='<v23:Amount>0</v23:Amount>';
 
- 		$xml.='</v23:UnitPrice>';
 
- 		$xml.='</v23:Commodities>';
 
- 		//DESC4
 
- 		$xml.='<v23:Commodities>';
 
- 		$xml.='<v23:NumberOfPieces>0</v23:NumberOfPieces>';//件数
 
- 		$xml.='<v23:Description>MADE IN CHINA</v23:Description>';//描述
 
- 		$xml.='<v23:CountryOfManufacture>CN</v23:CountryOfManufacture>';
 
- 		$xml.='<v23:Weight>';//需要填写重量
 
- 		$xml.='<v23:Units>KG</v23:Units>';//重量:磅
 
- 		$xml.='<v23:Value>0.0001</v23:Value>';//重量填写单位为KG
 
- 		$xml.='</v23:Weight>';
 
- 		$xml.='<v23:Quantity>1</v23:Quantity>';//需要填写数量
 
- 		$xml.='<v23:QuantityUnits>cm</v23:QuantityUnits>';
 
- 		$xml.='<v23:UnitPrice>';
 
- 		$xml.='<v23:Currency>USD</v23:Currency>';
 
- 		$xml.='<v23:Amount>0</v23:Amount>';
 
- 		$xml.='</v23:UnitPrice>';
 
- 		$xml.='</v23:Commodities>';	
 
- 		**/	
 
- 		$xml.='<v23:ExportDetail>';
 
- 		$xml.='<v23:ExportComplianceStatement>30.37(f)</v23:ExportComplianceStatement>';
 
- 		$xml.='</v23:ExportDetail>';
 
- 		$xml.='</v23:CustomsClearanceDetail>';
 
- $xml.='<v23:LabelSpecification>';
 
- 		$xml.='<v23:LabelFormatType>COMMON2D</v23:LabelFormatType>';
 
- 		$xml.='<v23:ImageType>PDF</v23:ImageType>';
 
- 		$xml.='<v23:LabelStockType>STOCK_4X6.75</v23:LabelStockType>';
 
- 		$xml.='</v23:LabelSpecification>';
 
- 		//发票参数开始
 
- 		$xml.='<v23:ShippingDocumentSpecification>';
 
-         $xml.='<v23:ShippingDocumentTypes>COMMERCIAL_INVOICE</v23:ShippingDocumentTypes>';
 
- 		//ETD
 
- 		$xml.='<v23:CommercialInvoiceDetail>';
 
-         $xml.='<v23:Format>';
 
-         $xml.='<v23:ImageType>PDF</v23:ImageType>';
 
-         $xml.='<v23:StockType>PAPER_LETTER</v23:StockType>';
 
-         $xml.='<v23:ProvideInstructions>true</v23:ProvideInstructions>';
 
-         $xml.='</v23:Format>';
 
- 		$xml.='<v23:CustomerImageUsages>';
 
-         $xml.='<v23:Type>LETTER_HEAD</v23:Type>';
 
- 		$xml.='<v23:Id>IMAGE_1</v23:Id>';
 
- 		$xml.='</v23:CustomerImageUsages>';
 
- 		$xml.='<v23:CustomerImageUsages>';
 
- 		$xml.='<v23:Type>SIGNATURE</v23:Type>';
 
- 		$xml.='<v23:Id>IMAGE_2</v23:Id>';
 
- 		$xml.='</v23:CustomerImageUsages>';
 
- 		//ETD
 
-         $xml.='</v23:CommercialInvoiceDetail>';
 
-         $xml.='</v23:ShippingDocumentSpecification>';
 
- 		//发票参数结束
 
- 		$xml.='<v23:RateRequestTypes>LIST</v23:RateRequestTypes>';//费率请求类型
 
- 		$xml.='<v23:PackageCount>'.$data['zjs'].'</v23:PackageCount>';//包装数量
 
- 		$xml.='<v23:RequestedPackageLineItems>';
 
- 		$xml.='<v23:SequenceNumber>1</v23:SequenceNumber>';
 
- 		$xml.='<v23:Weight>';
 
- 		$xml.='<v23:Units>KG</v23:Units>';
 
- 		$xml.='<v23:Value>'.$data['zzl'].'</v23:Value>';
 
- 		$xml.='</v23:Weight>';
 
- 		//超过重量需要填尺寸,现在不设置,超出也按0.4走
 
- 		if($data['zzl'] > '0.4')
 
- 		{
 
- 		    $xml.='<v23:Dimensions>';
 
- 		    $xml.='<v23:Length>4</v23:Length>';//$data['boxlength']
 
- 		    $xml.='<v23:Width>20</v23:Width>';
 
- 		    $xml.='<v23:Height>30</v23:Height>';
 
- 		    $xml.='<v23:Units>CM</v23:Units>';
 
- 		    $xml.='</v23:Dimensions>';
 
- 		}
 
- 		//$xml.='<v23:ItemDescription>Book</v23:ItemDescription>';//阿联酋需要选择
 
- 		$xml.='<v23:CustomerReferences>';
 
- 		$xml.='<v23:CustomerReferenceType>CUSTOMER_REFERENCE</v23:CustomerReferenceType>';
 
- 		$xml.='<v23:Value>'.$data['number'].'</v23:Value>';
 
- 		$xml.='</v23:CustomerReferences>';
 
- 		$xml.='</v23:RequestedPackageLineItems>';
 
- 		$xml.='</v23:RequestedShipment>';
 
- 		$xml.='</v23:ProcessShipmentRequest>';
 
- 		$xml.='</soapenv:Body>';
 
- 		$xml.='</soapenv:Envelope>';
 
- 		$ch = curl_init();
 
- 		curl_setopt($ch, CURLOPT_URL, 'https://ws.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);
 
- 		@$values = json_decode(json_encode(simplexml_load_string($result_xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
 
- 		if(isset($values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['MasterTrackingId']['TrackingNumber']))
 
- 		{
 
- 		    $g = array('x'=>'1','waybill'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['MasterTrackingId']['TrackingNumber'],'label'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['CompletedPackageDetails']['Label']['Parts']['Image'],'invoice'=>$values['SOAPENVBody']['ProcessShipmentReply']['CompletedShipmentDetail']['ShipmentDocuments']['Parts']['Image']);
 
- 		}
 
- 		else if(isset($values['SOAPENVBody']['ProcessShipmentReply']['Notifications']))
 
- 		{
 
- 			$a = '';
 
- 			if(isset($values['SOAPENVBody']['ProcessShipmentReply']['Notifications']['LocalizedMessage']))
 
- 			{
 
- 				$a = $values['SOAPENVBody']['ProcessShipmentReply']['Notifications']['LocalizedMessage'];
 
- 			}
 
- 			else
 
- 			{
 
-                 foreach ($values['SOAPENVBody']['ProcessShipmentReply']['Notifications'] as $v) 
 
- 		        {
 
- 				    $a .= $v['LocalizedMessage'].'--';
 
- 			    }
 
- 			}
 
- 			$g = array('x'=>'0','Description'=>$a);
 
- 		}
 
- 		else
 
- 		{
 
- 			$g = array('x'=>'0','Description'=>'未知错误');
 
- 		}
 
- 		return $g;
 
- 	}
 
- 	
 
- 	public function get_Upload_signature($id='',$img='')//上传签名图片
 
- 	{
 
- 		/**
 
- 		//一下为旧的测试账号
 
- 		$key = 'lx0vfuP9eZMXyDdd';
 
- 		$password = '1e6HFUgU1SxoZ6CpYMXBupqQY';
 
- 		$AccountNumber = '510087720';
 
- 		$MeterNumber = '100421603';
 
- 		**/
 
- 		
 
- 		//以下为旧的正式账号
 
- 		/**
 
- 		$key = 'L7Vtg0uUP0BxgNfp';
 
- 		$password = 'iOqmHwfjx12sxszdEZstGtRYs';
 
- 		$AccountNumber = '644155250';
 
- 		$MeterNumber = '250140772';
 
- 		**/
 
- 		
 
- 		$key = 'L7Vtg0uUP0BxgNfp';
 
- 		$password = 'iOqmHwfjx12sxszdEZstGtRYs';
 
- 		$AccountNumber = '644155250';
 
- 		$MeterNumber = '250140772';
 
- 		
 
-         $xml='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v11="http://fedex.com/ws/uploaddocument/v11">';
 
-         $xml.='<soapenv:Header/>';
 
-         $xml.='<soapenv:Body>';
 
-         $xml.='<v11:UploadImagesRequest>';
 
-         $xml.='<v11:WebAuthenticationDetail>';
 
-         $xml.='<v11:ParentCredential>';
 
-         $xml.='<v11:Key>'.$key.'</v11:Key>';
 
-         $xml.='<v11:Password>'.$password.'</v11:Password>';
 
-         $xml.='</v11:ParentCredential>';
 
-         $xml.='<v11:UserCredential>';
 
-         $xml.='<v11:Key>'.$key.'</v11:Key>';
 
-         $xml.='<v11:Password>'.$password.'</v11:Password>';
 
-         $xml.='</v11:UserCredential>';
 
-         $xml.='</v11:WebAuthenticationDetail>';
 
-         $xml.='<v11:ClientDetail>';
 
-         $xml.='<v11:AccountNumber>'.$AccountNumber.'</v11:AccountNumber>';
 
-         $xml.='<v11:MeterNumber>'.$MeterNumber.'</v11:MeterNumber>';
 
-         $xml.='</v11:ClientDetail>';
 
-         $xml.='<v11:TransactionDetail>';
 
-         $xml.='<v11:CustomerTransactionId>UploadImagesRequest_v11</v11:CustomerTransactionId>';
 
-         $xml.='</v11:TransactionDetail>';
 
-         $xml.='<v11:Version>';
 
-         $xml.='<v11:ServiceId>cdus</v11:ServiceId>';
 
-         $xml.='<v11:Major>11</v11:Major>';
 
-         $xml.='<v11:Intermediate>0</v11:Intermediate>';
 
-         $xml.='<v11:Minor>0</v11:Minor>';
 
-         $xml.='</v11:Version>';
 
-         $xml.='<v11:Images>';
 
-         $xml.='<v11:Id>IMAGE_2</v11:Id>';//填IMAGE_1和IMAGE_2,两个都需要传一遍
 
-         $xml.='<v11:Image></v11:Image>';//填LOGO 700*50 64编码 不用站长工具,转换错误
 
-         $xml.='</v11:Images>';
 
-         $xml.='</v11:UploadImagesRequest>';
 
-         $xml.='</soapenv:Body>';
 
-         $xml.='</soapenv:Envelope>';
 
- 	    $ch = curl_init();
 
- 	    //https://ws.fedex.com:443/web-services 正式
 
-         //https://wsbeta.fedex.com:443/web-services 测试
 
- 	    curl_setopt($ch, CURLOPT_URL, 'https://ws.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);
 
- 	    @$values = json_decode(json_encode(simplexml_load_string($result_xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
 
- 	    return $values;
 
- 	}
 
- 	
 
- 	public function get_logistics($number)//追踪快递
 
- 	{
 
- 		$key = 'L7Vtg0uUP0BxgNfp';
 
- 		$password = 'iOqmHwfjx12sxszdEZstGtRYs';
 
- 		$AccountNumber = '644155250';
 
- 		$MeterNumber = '250140772';
 
- 		
 
- 		$xml='<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v16="http://fedex.com/ws/track/v16">';
 
- 		$xml.='<soapenv:Header/>';
 
-         $xml.='<soapenv:Body>';
 
-         $xml.='<v16:TrackRequest>';
 
-         $xml.='<v16:WebAuthenticationDetail>';
 
-         $xml.='<v16:ParentCredential>';
 
-         $xml.='<v16:Key>'.$key.'</v16:Key>';
 
-         $xml.='<v16:Password>'.$password.'</v16:Password>';
 
-         $xml.='</v16:ParentCredential>';
 
-         $xml.='<v16:UserCredential>';
 
-         $xml.='<v16:Key>'.$key.'</v16:Key>';
 
-         $xml.='<v16:Password>'.$password.'</v16:Password>';
 
-         $xml.='</v16:UserCredential>';
 
-         $xml.='</v16:WebAuthenticationDetail>';
 
-         $xml.='<v16:ClientDetail>';
 
-         $xml.='<v16:AccountNumber>'.$AccountNumber.'</v16:AccountNumber>';
 
-         $xml.='<v16:MeterNumber>'.$MeterNumber.'</v16:MeterNumber>';
 
-         $xml.='</v16:ClientDetail>';
 
-         $xml.='<v16:TransactionDetail>';
 
-         $xml.='<v16:CustomerTransactionId>Track By Number_v16</v16:CustomerTransactionId>';
 
-         $xml.='<v16:Localization>';
 
-         $xml.='<v16:LanguageCode>EN</v16:LanguageCode>';
 
-         $xml.='<v16:LocaleCode>US</v16:LocaleCode>';
 
-         $xml.='</v16:Localization>';
 
-         $xml.='</v16:TransactionDetail>';
 
-         $xml.='<v16:Version>';
 
-         $xml.='<v16:ServiceId>trck</v16:ServiceId>';
 
-         $xml.='<v16:Major>16</v16:Major>';
 
-         $xml.='<v16:Intermediate>0</v16:Intermediate>';
 
-         $xml.='<v16:Minor>0</v16:Minor>';
 
-         $xml.='</v16:Version>';
 
-         $xml.='<v16:SelectionDetails>';
 
-         $xml.='<v16:CarrierCode>FDXE</v16:CarrierCode>';
 
-         $xml.='<v16:PackageIdentifier>';
 
-         $xml.='<v16:Type>TRACKING_NUMBER_OR_DOORTAG</v16:Type>';
 
-         $xml.='<v16:Value>'.$number['waybill'].'</v16:Value>';
 
-         $xml.='</v16:PackageIdentifier>';
 
-         $xml.='<v16:ShipmentAccountNumber/>';
 
-         $xml.='<v16:SecureSpodAccount/>';
 
-         $xml.='<v16:Destination>';
 
-         $xml.='<v16:GeographicCoordinates>rates evertitque aequora</v16:GeographicCoordinates>';
 
-         $xml.='</v16:Destination>';
 
-         $xml.='</v16:SelectionDetails>';
 
-         $xml.='</v16:TrackRequest>';
 
-         $xml.='</soapenv:Body>';
 
-         $xml.='</soapenv:Envelope>';
 
- 		$ch = curl_init();
 
- 	    //https://ws.fedex.com:443/web-services 正式
 
-         //https://wsbeta.fedex.com:443/web-services 测试
 
- 	    curl_setopt($ch, CURLOPT_URL, 'https://ws.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);
 
- 	    @$values = json_decode(json_encode(simplexml_load_string($result_xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
 
- 		if($values['SOAPENVBody']['TrackReply']['HighestSeverity'] == 'SUCCESS')//SUCCESS成功,FAILURE失败,ERROR错误,WARNING警告,NOTE注意
 
- 		{
 
- 			$zt = isset($values['SOAPENVBody']['TrackReply']['CompletedTrackDetails']['TrackDetails']['StatusDetail']['Description'])?$values['SOAPENVBody']['TrackReply']['CompletedTrackDetails']['TrackDetails']['StatusDetail']['Description']:'cw'; //In transit在途中,At FedEx destination facility配送中,Delivered完成
 
- 			if($zt == 'In transit')
 
- 			{
 
- 				$exstate = 2;
 
- 			}
 
- 			else if($zt == 'At FedEx destination facility')
 
- 			{
 
- 				$exstate = 3;
 
- 			}
 
- 			else if($zt == 'Delivered')
 
- 			{
 
- 				$exstate = 4;
 
- 			}
 
- 			else
 
- 			{
 
- 				$exstate = 0;
 
- 			}
 
- 			if($exstate > 0)
 
- 			{
 
- 			    $content = date('Y-m-d H',time()).'-查询成功';
 
- 			    $list = array('exstate'=>$exstate,'content'=>$content,'f'=>1);//正常可发送站内信
 
- 			}
 
- 			else
 
- 			{
 
- 				$list = '';
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			$content = date('Y-m-d H',time()).'-查询失败';
 
- 			$list = array('content'=>$content,'f'=>0);//非正常只更改详情信息
 
- 		}
 
- 	    return $list;
 
- 	}
 
- }  //end class
 
 
  |