This is my code. Am trying get information from a server.
But I got stuck in the middle. Please help me.
Am getting error such as
[errors] => Array ( [0] => error:14094410:SSL
routines:SSL3_READ_BYTES:sslv3 alert handshake failure ) )
Below is the code that I have written please check and help me. Will appreciate any help.
public function get_quotes(){
$reservation_obj->source = "test";
$reservation_obj->location_code = "test";
$reservation_obj->start_date = "2010-06-01 19:00";
$reservation_obj->end_date = "2010-06-04 13:50";
$reservation_obj->action = "get_quotes";
$json = json_encode($reservation_obj);
$curl_opts = array(
CURLOPT_HEADER => false,
CURLOPT_HTTPHEADER => array('Content-Type: text/json', 'Content-length: '.strlen($json)),
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $json,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => "https://myserver/test.php",
CURLOPT_VERBOSE => false,
CURLOPT_SSLCERT => getcwd()."/newfile.crt.pem",
CURLOPT_SSLCERTTYPE => "PEM",
CURLOPT_SSLKEY=> getcwd()."/newfile.key.pem",
CURLOPT_SSLKEYTYPE => "PEM",
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSLVERSION => 3
);
$curl = curl_init();
curl_setopt_array($curl, $curl_opts);
if(!$response = curl_exec($curl)){
$response->errors[] = curl_error($curl);
}
curl_close($curl);
if(count($response ->errors)){
print_r($response);
}else{
print_r($response);
}
}