I'm using Client URL to send POST data. Link to the source: http://hayageek.com/php-curl-post-get/#curl-post. The code is as following:
<?php
function httpPost($url,$params){
$postData = '';
//create name value pairs seperated by &
foreach($params as $k => $v){
$postData .= $k . '='.$v.'&';
}
rtrim($postData, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, count($postData));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$output=curl_exec($ch);
curl_close($ch);
return $output;
}
$params = array(
"name" => "Ravishanker Kusuma",
"age" => "32",
"location" => "India"
);
echo httpPost("http://www.jmediatechnology.eu/script.php",$params);
?>
I want to know wether this method is safe from hijacking or any other security issues.