php curl头传递身份验证

php curl头传递身份验证,php,curl,salesforce,Php,Curl,Salesforce,我正在尝试向sales force传递adobe插件的会话id。我是卷发新手,所以不确定这是否正确: $sf_sig = 'https://na25.salesforce.com/services/apexrest/echosign_dev1/template/load/a1t31000002HmjV&email=' . $email; //open connection $ch = curl_init(); $ch2 = curl_in

我正在尝试向sales force传递adobe插件的会话id。我是卷发新手,所以不确定这是否正确:

$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时,这是否正确?他承认了如何设置头球

这可能会对您有所帮助,它是这个伟大的Salesforce API类的一部分:

他有这样一个函数来创建标题字符串

/**
 * 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;
}

通常它表示查询字符串本身中的会话ID。如果这是$access_-token,您需要知道接收脚本对它的期望,但它可能类似于
code
$sf_-sig=“”。$email.&token=“。$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;
}