Knowledge Base: Curl errors with PHP
Mark Headd sent in the following note about using the API with PHP and curl. He had an issue with SSL support on his Ubuntu server and wrote up this solution.
I ran into an issue when trying to hit the IMified API using PHP's CURL functions on Ubuntu. I thought I'd share the problem I ran into and the fix in case others run into this issue.
Following the examples on the IMified site for using the API with PHP, I was able to successfully test API calls on my local development machine. However, when I moved to a hosted environment to run more tests, all of my API calls failed.
Because the API uses SSL you need to have the "ca-certificates" package installed if you are running Ubuntu. If you are testing API calls and the results are not what you expect, make sure you first check for errors using PHP's curl_error() function. If you see an error like this:
"error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none"
It means you need to install the ca-certificates package. Check the version of Ubuntu that you are running:
$ cat /etc/lsb-releaseThen you should be able to install the package using:
$ sudo apt-get install ca-certificates(I ran this on Hardy and it worked just fine.)
Hope this helps anyone else running into this same issue.