[英]Salesforce API PHP: Generate Token Error SSL23_CLIENT_HELLO
I am referring to API >> http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php 我指的是API >> http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php
I have to generate token to add lead into SF. 我必须生成令牌才能将铅添加到SF中。
Below is my code>> ` 下面是我的代码>>
if (!isset($code) || $code == "") {
die("Error - code parameter missing from request!");
}
$params = "code=" . $code. "&grant_type=authorization_code". "&client_id=" . CLIENT_ID. "&client_secret=" . CLIENT_SECRET. "&redirect_uri=" . urlencode(REDIRECT_URI);
$curl = curl_init($token_url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded','Connection: Keep-Alive'));
curl_setopt($curl, CURLOPT_SSLVERSION, 6);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 200 ) {
die("Error: call to token URL $token_url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
}
curl_close($curl);
$response = json_decode($json_response, true);
$access_token = $response['access_token'];
$instance_url = $response['instance_url'];
if (!isset($access_token) || $access_token == "") {
die("Error - access token missing from response!");
}
if (!isset($instance_url) || $instance_url == "") {
die("Error - instance URL missing from response!");
}
$_SESSION['access_token'] = $access_token;
$_SESSION['instance_url'] = $instance_url;
`
Above code is working fine on my localhost, but returns below error on server>> 上面的代码在我的本地主机上工作正常,但在服务器上返回以下错误>>
Error: call to token URL https://login.salesforce.com/services/oauth2/token failed with status 0, response , curl_error error:140740BF:SSL routines:SSL23_CLIENT_HELLO:no protocols available, curl_errno 35
We have installed SSL on server. 我们已经在服务器上安装了SSL。 Please advice about issue.
请咨询有关问题。
Thanks. 谢谢。
The issue is old OpenSSL library (0.9.8b) that doesn't support TLS 1.2. 问题是旧的OpenSSL库(0.9.8b)不支持TLS 1.2。 You need to install OpenSSL 1.0.1 or higher to get TLS 1.1 and TLS 1.2 support.
您需要安装OpenSSL 1.0.1或更高版本才能获得TLS 1.1和TLS 1.2支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.