That's all worked fantastically. I do however have some security concerns regarding the use cURL. I've done some research and ascertained that the hosting service should ensure that the PHP installation on the server has an up to date CA root certificate bundle.
Here’s info on installing it:
Apparently the path then need to be set in php.ini using something like this:
But that's something for the server guys to do.
I understand there's a couple of options I need to use in my curl request to check the ssl certificate is valid before sending any sensitive data and avoid a man in the middle attack where possible. Now these are the options I have set at the moment:
$ch = curl_init('https://www.url.com/index.php'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch);
I've found the following and wonder if the following is the correct usage if I just add them? Also what is the correct method of testing? I wanna make this as bulletrpoof as possible:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
Many thanks for the help!