<?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;
}
?>
它以传统方式工作,但是我想知道它在laravel中是如何工作的,但我不知道在哪里特别使用模型,控制器和路由来放置代码以使其在laravel中工作...我是laravel的新手。先生和女士,将有任何帮助。谢谢!