I'm trying to connect via PHP to the smartystreets API (liveaddress) on an IIS web server. I copied both the file_get_contents and cURL examples from here: SmartyStreets github PHP examples. Neither of them work. If I paste the URL directly into my browser, it does work. The file_get_contents example returns:
Warning: file_get_contents(https://api.qualifiedaddress.com/street-address/?street=817+Quail+Ln.+%2312+bakersfield%2C+ca+93309&auth-token=5Nk1%2FA) [function.file-get-contents]: failed to open stream: No such file or directory in C:\Inetpub\includes\myclass.php on line 28
I have confirmed in phpinfo that allow_url_fopen is on. I've also tried setting a user_agent. Still, this doesn't work.
The cURL example returns false.
Could this be something with IIS? Or perhaps due to a firewall setting? If so, how do I find out what port to open? Are there any other possibilities? Thank you!
Try this. Usually it is enough to get SSL
to work with cURL
(it is some kind of min./default/simple/widespread ;) configuration of SSL used for APIs), but anyway it depends on the provider SSL configuration.
curl_setopt($ch, CURLOPT_SSLVERSION, 3); // OpenSSL issue
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Wildcard certificate
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
If it won't work, try to know smth. about SSL configuration of your provider
and you will definitely find a solution.