Sign in to follow this  
Followers 0

[PHP] CURL security concerns

2 posts in this topic

This is a follow up from this particular thread:

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('');
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!


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.