the code i use
$curl = curl_init();
$url = $this->checkPointMgmntServer.$Name;
showMsg('running function: ',$Name,'');
showMsg('running json: ',$json,'');
#echo $this->cpSid;
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_USERPWD, "abc:password");
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 4s
curl_setopt($ch, CURLOPT_POST, 0); // set POST method
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
# curl_setopt($ch, CURLOPT_SSL_VERIFYSTATUS , FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json',
'x-chkp-sid: '.$this->cpSid
));
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); // add POST fields
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json;"));
try {
$result = curl_exec($ch);
}
catch(Exception $e)
{
print_r($e);
}
$trimed = json_decode($result, true);
return $result ;
}