Aug 5, 2018
0
Level 1
How to convert this CURL request structure into LARAVEL approach?
<?php
$data = array(
'_ip' => "00.000.00.000",
'_data' => array(
'_token'=> 'vxxxxxxx',
'url'=> 'http://localhost/sampleapi/',
'destination'=> 'New York City',
'hotelcheckin'=> '2018-10-12',
'hotelcheckout'=> '2018-10-13',
'rooms'=> '1',
'guests_count'=> '1 Adult + 1 Child',
'adult' =>'1',
'child'=>'1',
'childage1'=>'1'
)
);
$retrieve = curlRequest( $data );
print_r($retrieve);
function curlRequest($return){
$data = base64_encode(bin2hex(json_encode($return)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://sample.com/hotel-query?_data=".$data);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
?>
Its working in the traditional way but I want to know how it works in laravel. I dont know where specifically put the code in laravel... I am a newbie in laravel. *Any help will do Sir and Maam. Thank you!
Please or to participate in this conversation.