Curl and TLS

sylvia_sotomayo
Community Explorer

I don't know if anyone else has had this issue, but I had it and solved it, so I thought I would share.

My php scripts that used the Canvas API to do minor tasks failed. I couldn't figure out why. The same commands worked in the Live API and in Postman, but not when I tried it with php. It turned out I forgot all about the TLS upgrade. Telling curl to use TLS 1.2 fixed the issue. In php, that is done like so:

curl_setopt($ch, CURLOPT_SSLVERSION, 6); //Force requests to use TLS 1.2

Hope that helps someone out there!

-S