1

I'm trying to use Google's URL shortener service. The call from the command line succeeds:

curl -v https://www.googleapis.com/urlshortener/v1/url -H 'Content-Type: application/json' -d '{"longUrl": "http://www.google.com"}'

However, the equivalent using WWW::Curl::Easy returns an error code of 77. We've checked that the ca-bundle.crt file is world-readable as suggested in this answer. I'm really stumped. Any suggestions of things to try would be appreciated.

The Perl code works on our development server but is failing on the staging server so the code is correct.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Matt McCormick
  • 13,041
  • 22
  • 75
  • 83

2 Answers2

0

The error is due to corrupt or missing SSL chain certificate files in the PKI directory. You’ll need to make sure the files ca-bundle, following steps: In your console/terminal:

mkdir /usr/src/ca-certificates && cd /usr/src/ca-certificates

Enter this site: https://rpmfind.net/linux/rpm2html/search.php?query=ca-certificates , get your ca-certificate, for SO. Copy url of download and paste in url: wget your_url_donwload_ca-ceritificated.rpm now, install yout rpm:

rpm2cpio your_url_donwload_ca-ceritificated.rpm | cpio -idmv

now restart your service: my example this command:

sudo service2 httpd restart

very great good look

Santos L. Victor
  • 628
  • 8
  • 13
0

In my case "I was trying to use curl in cpp to perform a GET request" I tried solutions from : Curl in C++ - Can't get data from HTTPS the only thing that worked for me was to disable SSL verify peer using :

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);