I'm developing locally on a Windows IIS server and trying to use the Twitter API in my application, like this:
$settings = array(
'oauth_access_token' => "...",
'oauth_access_token_secret' => "...",
'consumer_key' => "...",
'consumer_secret' => "..."
);
$twitter = new TwitterAPIExchange($settings);
$url = "https://api.twitter.com/1.1/search/tweets.json";
$getfield = "?q=%23test";
$requestMethod = "GET";
$result = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
echo json_encode($result);
Running this gives me the following error:
Fatal error: Uncaught Exception: SSL certificate problem: unable to get local issuer certificate in C:\inetpub\wwwroot\...\vendor\j7mbo\twitter-api-php\TwitterAPIExchange.php on line 321 Exception: SSL certificate problem: unable to get local issuer certificate in C:\inetpub\wwwroot\...\vendor\j7mbo\twitter-api-php\TwitterAPIExchange.php on line 321
I have found out that you need to add a SSL certificate, I've downloaded the cacert.pem but I'm lost on how to enable it in IIS. Any pointers?
Edit: So I have now imported a certificate from our company in IIS, my server is now running on https. I added this to my php.ini
:
curl.cainfo = "C:\...\certificate.PFX"
But after restarting the server I'm still getting the same error.