Which is more secure GET or POST sending parameters with cURL at PHP
Posted
by
Steve
on Stack Overflow
See other posts from Stack Overflow
or by Steve
Published on 2012-11-30T11:00:26Z
Indexed on
2012/11/30
11:03 UTC
Read the original article
Hit count: 269
I want to connect in a secure way with an API and I am using cURL
to do it using HTTPS and SSL.
Now, i was wondering what is better in terms of security, sending the data through GET
or POST
:
$ch = curl_init("http://api.website.com/connect.php?user=xxx&pass=xxxx);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);
Or
$param['user'] = 'xxxx';
$param['pass'] = 'xxxx';
$ch = curl_init("http://api.website.com/connect.php);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $Parameters);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result = curl_exec($ch);
curl_close($ch);
I also realized that POST
is much more slower retrieving the data.
© Stack Overflow or respective owner