Test twitters php api locally without ssl - php

I am trying to get twitter to post to my wall via php and the only way I can see to do it is by first having a auth tocken and to get that I need to ask twitter for it :) Facebook do it better ;p
So I am using ricardoper/twitteroauth to do this and when trying to get the tockens I get this back from hitting the curl file seen here: https://github.com/ricardoper/TwitterOAuth/blob/v2/src/Common/Curl.php
I am unsure if its because I'm running php locally or if its something to do with twitter.
<br />
<b>Fatal error</b>: Uncaught cURL Lib: [60] SSL certificate problem: unable to get local issuer certificate (TwitterOAuth\Exception\CurlException)
thrown in <b>C:\var\www\fbshare\TwitterOAuth\src\Common\Curl.php</b> on line <b>110</b><br />
How can i overcome this error, or be able to post to twitter, but I believe this script does that.

Turns out that the repo I was using's pem wasn't supporting ssl on the local host.
I download a local ssl certificate from here
Replaced line 64 with CURLOPT_CAINFO => '/var/www/cacert.pem', which was the downloaded pem from the link given above and now I can access ssl locally :)

Related

Docusign error: "unable to get local issuer certificate"

We're using the Docusign RestAPI (PHP SDK) from our app and it works great. Authentication mode is JWT. I want to use all the code I've written on a different subdomain, but I get this error:
API call to https://account.docusign.com/oauth/token failed: SSL certificate problem: unable to get local issuer certificate
Both domains, my-domain.com and new.my-domain.com have SSL certs installed. What do I do now? What have I missed?
The DocuSign public certificates page lists all certificates.
Scroll down and look for this:
Install the certificate on your server where you are running the code from.
Do you have the standard set of trusted root certs installed in PHP?
This article may help you.
SOLVED: the new subdomain was operating on a different version of PHP. I added the cert paths to that php.ini file and it works as it should now.

WooCommce Error: cURL error 60: SSL certificate problem: unable to get local issuer certificate.

I am integrating Woo-commerce API's in my Laravel 5.6 site using Woo-commerce official rest sdk. I made a link using authentication endpoint URL.Which is mention at here .
When user clicks the link it takes the user to Woo-commerce authentication page, where user login and Approve the request.
After approving the request it should take me to return url which i mention in the link.
Instead it shows me the following error.
Error: cURL error 60: SSL certificate problem: unable to get local issuer certificate.
I have tried this. But it's also not working.
I put the cacert.pem in '/etc/ssl/certs' directory,
also make the entry in php.ini like
curl.cainfo = "/etc/ssl/certs/cacert.pem". But it's not working.
After investigation I found the solution.
It does not work without ssl certificate.
I have install certificate using this link and it works.

Dropbox API unable to fetch request tokens

I've developed a small Dropbox based app. I've done all the coding in PHP using symfony 1.4 and the dropbox-php library. Locally on my machine everything works just fine. But on a public test server the the dropbox-php library fails to retrieve the request tokens.
The app key and app secret are the same on both machines and I'm using the PHP OAuth extension as the OAuth library. The Dropbox App is in development mode and I've also enabled additional users for it from the Dropbox App Dashboard.
Not sure if this helps but here's the piece of code:
$oauth = new Dropbox_OAuth_PHP(sfConfig::get('app_dropbox_app_key'), sfConfig::get('app_dropbox_app_secret'));
$tokens = $oauth->getRequestToken();
...and this the exception thrown:
500 | Internal Server Error | Dropbox_Exception_RequestToken
We were unable to fetch request tokens. This likely means that your consumer key and/or secret are incorrect.
From the error message it looks like the the app key and app secret combination is wrong. But the combination is right since it works on my machine and I've been using it for days to develop this small app. The 43 port is open on the server and the php_oauth.dll is loading correctly.
Any ideas about what I'm doing wrong here?
I've switched to Dropbox_OAuth_Curl but it didn't work either. The error:
Curl error: (77) error setting certificate verify locations:
CAfile: rootca
CApath: none
So I've set:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
And it works.
Can this be somehow related to Dropbox_OAuth_PHP not working?

Execute Apple Push Notification Server (PHP) from Android Device using "PHP for Android"

I recently downloaded and installed "PHP for Android." I created a .php file that utilizes an SSL connection with port 2195. I followed a guide for writing a php server that sends push notifications to Apple's APNS, and SUCCESSfully ran it on my Mac. When I put both the .php and the .pem onto my Android phone in the same folder and tried to run it with the same WIFI connection, I get the following error message:
Error:14094410:SSL routines:func(148):reason(1040) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): Failed to enable crypto in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /mnt/sdcard/sl4a/scripts/lot.php on line 19
Does anyone have any ideas of how I can fix this?
THANKS!
I had the SSL error on my Windows desktop, with a PHP script that accessed a HTTPS resource.
The solution was to enable the openssl extension. So maybe it's the same kind of problem you have here, something related to opensll on Php for Android.
I'm not sure how to fix it, but Google has it's own push notification framework. There is an example here: http://code.google.com/android/c2dm/
Edit to Answer:
I think that most likely the problem has to do with the certificates needed to make the call over SSL. It is possible that the PHP for Android app does not have permissions to access security certificates you need.

Facebook SDK error: uncaught curlexception: 28: connect() timed out! thrown in php

I just follow same code from Facebook SDK example.
If FB App point to my local desktop, it will get Facebook uid and user basic information (ex email) if APP get permission from OAUTH request.
But when I upload files to server, executing $facebook->api('/me');
Fatal error: Uncaught CurlException: 28: connect() timed out! thrown in
/xxx/src/facebook.php on line 622
I still can't figure out why. It comes from CURL or SSL setting?
My remote server support SSL and CURL is enabled. My local is only CURL but no SSL support.
I think my Facebook SDK is old version, only facebook.php without base_facebook.php.
I try to use new version but can't run any program because crt error.
You get this error because your host cannot access the Facebook API. It might have an old version of Open SSL, can you check the current version on the server?
Try to connect using SSL from your local setup as well as it might be easier to debug on your local machine.
Also, see about that crt (CRC?) error and try to fix that first (don't shave too many Yak's though).

Categories