Skip to content

How to access RocketLeague API using PHP? #83

Description

@samjco

I have signup for the developer API on TRN site and received my KEY.

If I go here I can see the data in my browser:
https://api.tracker.gg/api/v2/rocket-league/standard/profile/epic/all4gaming

However....
I have tried using the following:

using a simple php function:
file_get_contents("https://api.tracker.gg/api/v2/rocket-league/standard/profile/epic/all4gaming");
Doesn't work or maybe there is a blocking

// Create a stream
$opts = array(
	'http'=>array(
		'method'=>"GET",
		"header" =>  "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36\r\n"
		. "TRN-Api-Key: XXXXX-XXXX-XXXXX\r\n" //My TRN KEY
		. "Accept: application/json\r\n"

	)
  );
  
$context = stream_context_create($opts);
echo file_get_contents("https://api.tracker.gg/api/v2/rocket-league/standard/profile/epic/all4gaming", false, $context);

Nothing doesnt seem to work. How can I get this working?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions