+ Start a Discussion
Sombir SinghSombir Singh 

To test the compatibility of an API client that uses REST to communicate with Salesforce

May be this is duplicate question, someone please suggest me on the below issue : 

CURL Version is 7.19.7 for more details see the attachement.


User-added image

My Current Code to test : 'https://tls1test.salesforce.com/services/oauth2/token';

$this->salesForceUrl = 'https://tls1test.salesforce.com/services/oauth2/token';
$post_params = 'grant_type=password&client_id=' . $this->salesForceClientKey . '&client_secret=' . $this->salesForceClientSecret . '&username=' . $this->salesForceUsername . '&password=' .$this->salesForcePassword . $this->salesForceSecurityToken;
//Call sales force login method
$ch = curl_init($this->salesForceUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$res = curl_exec($ch);
print_r($res);
$jd = json_decode($res);
echo 'curl_errno is : '.curl_errno($curl);            
print_r($jd);
print_r(curl_getinfo($ch));
curl_close($ch);

if(isset($jd)){ //Check the response
    echo "\n" .  date("D M d h:i:s Y") . ":  logged in to: " . $this->salesForceUrl;
    return true;
}else{
    echo "\n" .  date("D M d h:i:s Y") . ":  Error trying login to: " . $this->salesForceUrl;
    return false;
}


OUTPUT is : SSL Connect error : 35 & http_code i am getting 0(zero).


User-added image


After that i have added one line in the curl code :  curl_setopt($curl, CURLOPT_SSLVERSION, 6);

$this->salesForceUrl = 'https://tls1test.salesforce.com/services/oauth2/token';
$post_params = 'grant_type=password&client_id=' . $this->salesForceClientKey . '&client_secret=' . $this->salesForceClientSecret . '&username=' . $this->salesForceUsername . '&password=' .$this->salesForcePassword . $this->salesForceSecurityToken;
//Call sales force login method
$ch = curl_init($this->salesForceUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSLVERSION, 6);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$res = curl_exec($ch);
print_r($res);
$jd = json_decode($res);
echo 'curl_errno is : '.curl_errno($curl);            
print_r($jd);
print_r(curl_getinfo($ch));
curl_close($ch);

if(isset($jd)){ //Check the response
    echo "\n" .  date("D M d h:i:s Y") . ":  logged in to: " . $this->salesForceUrl;
    return true;
}else{
    echo "\n" .  date("D M d h:i:s Y") . ":  Error trying login to: " . $this->salesForceUrl;
    return false;
}

OUTPUT is : SSL Connect error : 0 & http_code i am getting 400.

User-added image


As per the link if i am getting 400 Bad Request , it means my TLS connection is passed.
But as per my finding for TLS 1.2, i need to upgarde curl version atleast 7.34.0.

In the above test code i am getting 400 Bad request without upgrading curl version, Please let me know do i still need to upgrade curl version or it is not required, when Salesforce deactivates TLS 1.0 

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Please refer below Salesforce help document which explains how to prepare for the change.

Refer To test the compatibility of an API client that uses REST to communicate with Salesforce: in the same document.

https://help.salesforce.com/articleView?amp;language=en_US&id=000221207&type=1
 
Hope this helps you!

If this helps you, please mark it as solved.

Thanks and Regards
Sandhya