title: Sending "curl -X GET --header" via php curl not working
body: <p>So i'm trying to use the <a href="https://api.thetvdb.com/swagger" rel="nofollow noreferrer">https://api.thetvdb.com/swagger</a> api via PHP.</p>
  
  <p>I've successfully managed to get a JWT token from the API using the following method:</p>
  
  <pre><code>function tvdb_post ($url, $userinfo) {
      $ch = curl_init($url);
      $payload = json_encode($userinfo);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $result = curl_exec($ch);
      curl_close($ch);
      $return = json_decode($result, true);
  
      return $return; 
  }
  
  $userinfo = array (
      'username' =&gt; 'dstealth',
      'userkey' =&gt; '***{redacted}***',
      'apikey' =&gt; '***{redacted}***'
  );
  
  $token = tvdb_post('https://api.thetvdb.com/login', $userinfo);
  </code></pre>
  
  <p>I then copy the token and submit it on the API webpage to submit the token. It gives me a confirmation message.</p>
  
  <p>The problem arises from the next step. If I do the previous steps ON the API website page, and then do the next step ON the API webpage, it works just fine. But when I try to convert the next step into PHP, it gives me a "Not Authorized" messaged.</p>
  
  <p>The next step on the API webpage is:</p>
  
  <pre><code>curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer &lt;token&gt;' 'https://api.thetvdb.com/refresh_token'
  // returns a response code 200 and refreshes the token successfully.
  </code></pre>
  
  <p>in php my next step looks like this:</p>
  
  <pre><code>$authorization = "Authorization: Bearer ***{redacted}*** ";
  
  function tvdb_api ($url) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', $authorization));
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $json = curl_exec($ch);
      curl_close($ch);
      $array = json_decode($json, true);
  
      return $array;
  }
  
  $refresh = tvdb_api('https://api.thetvdb.com/refresh_token');
  // This returns a "Not Authorized" error.
  </code></pre>
  
  <p>Can anyone please tell me what i'm doing wrong between converting the next step from the API webpage to php?</p>