Here is my API end point
https://tequila-api.kiwi.com/v2/search?fly_from=SYD&fly_to=AMD&dateFrom=01/10/2022&dateTo=10/10/2022&curr=AUD&returnFrom=30/10/2022&returnTo=05/11/2022
apikey is 41uZ2MyzYos8NP5vr-dUypkAVrro9cpQ Please do not worry about this key. I will delete it once I found the solution here.
I want to display the first price end point (data/0/price) which is $912 in this example.
Here is what I tried so far. It displays entire JSON but I just need to display "price" endpoint which is under "data" and then "0".
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://tequila-api.kiwi.com/v2/search?fly_from=SYD&fly_to=AMD&dateFrom=01/10/2022&dateTo=10/10/2022&curr=AUD&returnFrom=30/10/2022&returnTo=05/11/2022',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: 41uZ2MyzYos8NP5vr-dUypkAVrro9cpQ'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}