• Sombir Singh
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
For production connection i am using https://login.salesforce.com/services/oauth2/token url to login, after successful login it return an intance URL and based oon that instance url i am fetching the data from salesforce using below query via php curl command : 

$ch = curl_init($this->salesForceInstanceUrl . '/services/data/v24.0/query/?q=' . $query); //Call the sales force query method
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            $jd = json_decode(curl_exec($ch));
            curl_close($ch);

But now i am trying to connect my sandbox account https://cs53.salesforce.com/services/oauth2/token, i am able to login but when fetching data with the same curl commad not getting any results. 

Do i need to changes the servies data end point (services/data/v24.0/query) for sandbox account, if yes where i can found these details.

Thanks in Advance.




 
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 

 
Reagrding the topic "Salesforce disabling TLS 1.0" as mentioned in the link "https://help.salesforce.com/apex/HTViewSolution?id=000221207&language=en_US"
Which is the forum where I can post questions pertiaining to the above link

I am testing the API compatability Tests "How do I test the compatibility of an API (inbound) integration to Salesforce?"
When I run the test I see the following "Handshake Error " error

main, READ: TLSv1 Alert, length = 2
main, RECV TLSv1 ALERT:  fatal, handshake_failure
main, called closeSocket()
main, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
        at com.ibm.jsse2.j.a(j.java:4)
        at com.ibm.jsse2.j.a(j.java:31)
        at com.ibm.jsse2.qc.b(qc.java:624)

        
Is that my applicaton no compatabile, but I see that we are using TLSv1 which is supposed to eb supported

Regds,
Deepak