How to use the SSL Certificate?


I’m trying to connect to Twitter API v1.1 using SSL as instructed here: and here

However I have no idea how to use the certificate to connect!! I keep getting a NULL http_code when tryign to connect.

Quite frankly the part I’m having trouble is the certificate. How or what exactly do I include inside the .CRT file???
Am I suppose to go to and copy and paste all of that .CER files into one file?? Am I suppose to use one of these files??

Can someone please give a more detailed information on how to use the certificate to connect??


Every HTTP client in every library/language has a configuration that sets what path the certificates must to be located and what format you should follow to store them there, there is no single pattern. Search in forums of the language or library you are using to do this connection and you might find procedures you should follow to install the certificates.


I’m using PHP

I don’t think the way I’m setting the path to the certificate is a problem at all. I mean, after all its pretty straightforward.

Looking at the example in the link above, this code is really not hard to follow.
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, True);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($connection, CURLOPT_CAINFO, “path:/ca-bundle.crt”);

What I’m having trouble with is what should be inside the ca-bundle.crt ???

When I go to there are dozens of files I can download. Which one do i download?? What should be inside the ca-bundle.crt ??


Given that you are using PHP, which uses curl, please follow the procedures:

  1. download and save it somewhere. (this pem file already has Verisign root needed for
  2. update php.ini – add curl.cainfo = “PATH_TO/cacert.pem”

Otherwise you will need to do the following for every cURL resource:

curl_setopt ($ch, CURLOPT_CAINFO, “PATH_TO/cacert.pem”);




Thank you, however even though I originally thought that the cert file was the problem, it is not. Ever since Jan 15, when I try to connect to Twitter API, I get a NULL http_code. I had thought that this was due to the cert file being wrong but after downloading that cert file, it still does not work.

Do you know why I may be receiving a NULL http_code upon connection attempt?? I am using abraham’s twitter oauth code.


Honestly is there some kind of example code for connecting to Twitter using SSL?? It would help tremendously.


For example codes in PHP, read carefully these repos READMEs and execute their examples:



STILL not working.

What’s frustrating is that I get nothing returned!! No error messages or anything.

What are the reasons why I would get a NULL returned?? Is it possible that I’m banned somehow?? Shouldn’t I get some kind of http error code returned upon failure??


Can you paste here the log you are getting when trying to connect?


I’m not sure I’m on the right track and it’s VERTY frustrating, since I’m not a “techie”. I can see the new certificate, but I don’t have the option to verify it. I have no idea what to do next. I am using a Blackberry. Thanks for your help


javax.servlet.ServletException: 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (
SSL is required
Relevant discussions can be on the Internet at: or
TwitterException{exceptionCode=[6c607809-0f1d8125], statusCode=403, retryAfter=0, rateLimitStatus=null, version=2.2.0}

please provide solution . how to solve the problem?


my twitter wont open


i get this

Cannot connect to the real

Something is currently interfering with your secure connection to

Try to reload this page in a few minutes or after switching to a new network. If you have recently connected to a new Wi-Fi network, finish logging in before reloading.

If you were to visit right now, you might share private information with an attacker. To protect your privacy, Chrome will not load the page until it can establish a secure connection to the real