1. 程式人生 > >php soap 通訊

php soap 通訊

與 xx crm 通訊介面呼叫

$url = 'http://xxxxx.com/xxxxxxxxxxxxx?WSDL';
$soapClient = new SoapClient( $url , array('trace'=>true) ); 


// Prepare SoapHeader parameters 
$sh_header = array( 
    'UserIdentity'    =>    'IT2015'
);
$headers = new SoapHeader('http:://tempuri.org', 'CustomSoapHeader', $sh_header
); $soapClient->__setSoapHeaders(array($headers)); $json = array( array( "TypeName" => "廠家線索", "ShopID" => 2927, "Shnumber" => "", "OrderType"=> "整車", "Channels"=> "官網", "ChildChannel"=> "世界盃官網活動", "IntentBrandID"=> "34"
, "IntentBrandName"=> "引數", "CustomerName"=> "計先生", "Contact"=> "158xxxx293", "Province"=> "河北省", "City"=> "保定市", "Gender"=> 1, "Remark"=> "網際網路廣告", "ActivitiesName"=> "渠道名+專題活動" ), ); $ap_param = array( 'saleClueJson'
=> json_encode( $json), 'productJson' => '', 'productBoutiqueJson' => '', 'LeadChannelType' => 1, ); // Call RemoteFunction () $error = 0; try { $info = $soapClient->__call("SaveChannelWithJson", array($ap_param)); var_dump( $info); } catch (SoapFault $fault) { $error = 1; print(" alert('Sorry, blah returned the following ERROR: ".$fault->faultcode."-".$fault->faultstring.". We will now take you back to our home page.'); window.location = 'main.php'; "); }