I'm currently trying to fetch some data with a curl request from this link. Doing this returns the following:
"HTTP/2 403 server: AkamaiGHost mime-version: 1.0 content-type: text/html content-length: 293 expires: Sun, 11 Aug 2019 08:34:24 GMT date: Sun, 11 Aug 2019 08:34:24 GMT
Access Denied
You don't have permission to access "http://www.g2a.com/lucene/search/filter?" on this server.
Reference #18.9d0c1502.1565512464.22e1446"
I know that curl works fine because it works with other requests, it's just this one that gets denied. Also, opening the link with a browser doesn't show the "Access Denied" error but actually returns the data I need.
This is the curl request copy-pasted from the code:
try{
// initiate curl (used to request data from other webpages)
$ch = curl_init();
// will return the response, if false it prints the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// set the url, eliminates headers from response
curl_setopt($ch, CURLOPT_URL, $g2a);
curl_setopt($ch, CURLOPT_HEADER, true);
// execute
$result=curl_exec($ch);
//if some error occurs
if (!$result)
throw new Exception(curl_error($ch), curl_errno($ch));
// Closing
curl_close($ch);
} catch(Exception $e) {
trigger_error(sprintf('Curl failed with error #%d: %s', $e->getCode(), $e->getMessage()), E_USER_ERROR);
}
var_dump($result);
//converts json to associative array
$result=json_decode($result, true);
Any ideas on what could be the problem?