php soap 通信

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Webben/article/details/81068654

与 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'; 
    "); 
} 

猜你喜欢

转载自blog.csdn.net/Webben/article/details/81068654