I am trying to use cURL to post to an API that just started using SNI (so they could host multiple ssl certs on 1 IP address).
My cURL stopped working as a result of this move to SNI. They explained that it's because cURL is getting *.domain-a.com back instead of *.domain-b.com so the SSL fails.
This seems to be a bug in cURL because the API URL has no errors when visited from a browser.
Using this code, it does work:
exec('curl -k -d "parameters=here", https://urlhere.com/', $output);
print_r($output);
However, using -k is bad because it doesn't verify the SSL cert.
Using this code, does NOT work:
exec('curl -d "parameters=here", https://urlhere.com/', $output);
print_r($output);
So my question is, how can I use curl with SNI and still verify the SSL (not have to use -k). Is there another setting in PHP or a cURL option I can set to work around this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…