我正在尝试将会话ID传递给adobe插件的销售人员。我是卷毛新手,所以不确定这是否正确:
$sf_sig = 'https://na25.salesforce.com/services/apexrest/echosign_dev1/template/load/a1t31000002HmjV&email=' . $email;
//open connection
$ch = curl_init();
$ch2 = curl_init();
//ch2
curl_setopt($ch2, CURLOPT_URL, $sf_sig);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $access_token));
当adobe声明我需要使用带有会话ID的URL时,这是否正确?被承认如何设置标头。
答案 0 :(得分:0)
这可能对您有所帮助,它是这个出色的Salesforce API类的一部分:https://github.com/jahumes/salesforce-rest-api-php-wrapper/blob/master/SalesforceAPI.php
// Set the Authorization header
$request_headers = array(
'Authorization' => 'Bearer ' . $this->access_token
);
...
curl_setopt($this->handle, CURLOPT_HTTPHEADER, $this->createCurlHeaderArray($request_headers));
他有一个像这样的函数来创建标题字符串......
/**
* Makes the header array have the right format for the Salesforce API
*
* @param $headers
* @return array
*/
private function createCurlHeaderArray($headers) {
$curl_headers = array();
// Create the header array for the request
foreach($headers as $key => $header) {
$curl_headers[] = $key . ': ' . $header;
}
return $curl_headers;
}