I have got a problem with a PHP cURL request, it displays the 403 error.
In Postman and a browser the URL works fine and Postman produced the PHP cURL code which is below but show 403 error anyway. I guess there is a cookie being generated in the same call, but CURLOPT_COOKIESESSION
is not working. Can anyone please help with the code below to get a JSON data? Many thanks.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.britishairways.com/solr/lpbd/lpfdestinations?fq=departure_city:LON+AND+arr_city_name_search:***+AND+trip_type:RT+AND+number_of_nights:7+AND+cabin:M&facet.pivot=arrival_city,is_sales_fare&facet=true',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_COOKIESESSION => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;