I have a website which populates it's data through API. I read its documentation to get its data and it suggested using curl. I'm not familiar with curl so I went to learn it by myself and came up with the following code:
$url = 'https://api.flightplandatabase.com/search/plans?fromICAO=EHAM&toName=Kennedy&limit=1';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl);
$datasearch = json_decode($data);
echo $datasearch['id'];
curl_close($curl);
But I get a blank page while I'm trying to show the plan's id. If I remove curl_setopt then it gives me the whole JSON data. please tell me what I'm doing wrong. Thanks