php SalesForce Leads - POST
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php SalesForce Leads - POST相关的知识,希望对你有一定的参考价值。
<?php
$Phone = $_REQUEST['Phone'];
$Title = $_REQUEST['Title'];
$Company = $_REQUEST['Company'];
$Industry = $_REQUEST['Industry'];
$OwnerId = $_REQUEST['OwnerId'];
$LeadSource = $_REQUEST['LeadSource'];
$Status = $_REQUEST['Status'];
$LastName = $_REQUEST['LastName'];
$Rating = $_REQUEST['Rating'];
$Website = $_REQUEST['Website'];
$apiurl = 'https://[instance_url]/services/data/v37.0/sobjects/Lead/';
$body = array(
'Phone' => $Phone,
'Title' => $Title,
'Company' => $Company,
'Industry' => $Industry,
'OwnerId' => $OwnerId,
'LeadSource' => $LeadSource,
'Status' => $Status,
'LastName' => $LastName,
'Rating' => $Rating,
'Website' => $Website,
);
$body_json = json_encode($body);
$headers = [
'Authorization: Bearer [token]',
'Content-Type: application/json'
];
$http = curl_init();
curl_setopt($http, CURLOPT_HEADER, false);
curl_setopt($http, CURLOPT_RETURNTRANSFER, true);
curl_setopt($http, CURLOPT_HTTPHEADER, $headers);
curl_setopt($http,CURLOPT_URL, $apiurl);
curl_setopt($http,CURLOPT_POST, true);
curl_setopt($http,CURLOPT_POSTFIELDS, $body_json);
$results = curl_exec($http);
$http_status = curl_getinfo($http, CURLINFO_HTTP_CODE);
$info = curl_getinfo($http);
$results_json = json_decode($results);
if(isset($results_json->id))
{
$id = $results->id;
echo "SUCCESS!!!<br />";
echo "id: " . $id . "<br />";
}
else
{
echo "FAILURE!!!<br />";
}
curl_close($http);
?>
以上是关于php SalesForce Leads - POST的主要内容,如果未能解决你的问题,请参考以下文章
php SalesForce Leads - GET
PHP zip 下载错误
工具包php / Salesforce:改变lang
html 捕获leads.html
Miss leads pain ?
FlinkZookeeper connection loss leads to Flink job restart