'Rocket League API Not giving data
I've been trying to use the Rocket League API from the trackerhttps://api.tracker.gg/api/v2/rocket-league/standard/profile/(platform)/(name)
When i use the link I get the stats but I want to make a small website just for fun... I have a simple form to insert username and platform but I can't make the request neither using js neither using php.
I used their API to get Fortnite and CSGO stats and it did work.
My try in JS:
const fetchPlayers = async (gamertag, platform) => {
    const api_call = await fetch('https://api.tracker.gg/api/v2/rocket-league/standard/profile/${platform}/${gamertag}');
    const data = await api_call.json();
    console.log(data);  // Error 403 forbidden
    return { data }
};
My try in PHP
function getPlayerStatsRocket($platform,$gamertag){
    echo "asd";
    $apiUrlPlayerStatsEndpoint = 'https://api.tracker.gg/api/v2/rocket-league/standard/profile/'.$platform.'/'.$gamertag;
    $ch = curl_init();
    curl_setopt( $ch, CURLOPT_URL, $apiUrlPlayerStatsEndpoint );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, TRUE );
    curl_setopt( $ch, CURLOPT_HEADER, FALSE );
    curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
    $response = curl_exec( $ch );
    curl_close( $ch );
    return json_decode( $response, true ); //(returning null)
}
(No api key needed)
Solution 1:[1]
I am one of the developers providing the solution to your problem to a variety of programmers that are being blocked just like yourself.
To clarify, error code 1020 is the error code CloudFlare actually gives when it's detected a bot or when a firewall rule is being broken.
There's multiple ways to go about this, and I actually provide one of the ways to go around this for multiple developers.
I could of course spill out the answer freely through StackOverflow but that would defeat the purpose of it, haha.
Feel free to add me on Discord PGSleepy#2108 and I'll supply you with a fitting solution. (Also for other developers, of course!)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | PGSleepy | 
