title: CURL Request with PHP through GraphQL
body: <p>I know some PHP but I don't know a thing about GraphQL, so I'm trying to do an CURL HTTP request to Smash.gg with their API, but I keep getting &quot;Invalid authentication token&quot; back even though I keep using it on the GraphQL tester they have <a href="https://developer.smash.gg/explorer/" rel="nofollow noreferrer">here</a> and it works like it's supposed to. If someone could tell me how to get this working, that'd be great. Thanks.</p>
  <pre><code>&lt;?php
  
  $query = '
  query TournamentsByOwner($perPage: Int!, $ownerId: ID!) {
      tournaments(query: {
        perPage: $perPage
        filter: {
          ownerId: $ownerId
        }
      }) {
      nodes {
        id
        name
        slug
      }
    }
  }
  ';
  $variables = '
    &quot;ownerId&quot;: 161429,
    &quot;perPage&quot;: 4
  ';
  
  $json = json_encode(['query' =&gt; $query, 'variables' =&gt; $variables]);
  
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, 'https://api.smash.gg/gql/alpha');
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);    
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
  curl_setopt($curl, CURLOPT_VERBOSE, true);
  curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
  curl_setopt($curl, CURLOPT_HTTPHEADER,
       array(
              'User-Agent: PHP Script',
              'Content-Type: application/json;charset=utf-8',
              'Authorization: bearer XXXXXXXXXXXXXXXXX' 
          )
      ); 
  
  $response = curl_exec($curl);
  echo $response;
  
  ?&gt;
  </code></pre>