Clidus / gwl

Video game collection, wishlist and backlog tracker.
https://www.gamingwithlemons.com/
MIT License
18 stars 6 forks source link

Giant Bomb API now working? #78

Open Clidus opened 9 years ago

Clidus commented 9 years ago

I'll make this a wiki page when I have a moment.

Giant Bomb are currently blocking most commercial hosting providers by IP address to reduce the amount of bots attacking the API. You can read more about this on their forums.

This script will test if you are being blocked. You need to add your API key as the end of the $url variable. If the page outputs the JSON result of the API, you're good to go. If you get a page saying you're not a human, or some other error message, you're server IP is being blocked.

Note: You'll need to disable the rules in the .htaccess file to use this php script.

<?php

echo '<b>SERVER_ADDR:</b> ' . $_SERVER['SERVER_ADDR'];

$url = 'http://www.giantbomb.com/api/search/?query=mario&api_key=ApiKeyGoesHere';

echo '<br /><b>API Request:</b> ' . $url;

$ch = curl_init($url);
$options = array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTPHEADER => array('Content-type: application/json'),
    CURLOPT_USERAGENT => 'YourUserAgentGoesHere',
);
curl_setopt_array($ch, $options);
$json = curl_exec($ch);
curl_close($ch);

$result = json_decode($json);

echo '<br /><b>Result:</b> ' . $json;

?>

To get your server white-listed, contact ipbans@gamespot.com with your IP address.

Clidus commented 8 years ago

Update: Giant Bomb have started blocking empty user agents. You now need to specify a unique user agent so they can tell who is making requests. I've updated the above test script, remember to change the user agent to your own.