title: How to authenticate to Quickbooks Online API using CURL & PHP
body: <p>I normally use the PHP SDK which works well. However,  I need to call a resource that is not currently available via the SDK which is the ability to pull in a PDF invoice as per <a href="https://developer.intuit.com/docs/api/accounting/invoice" rel="nofollow">https://developer.intuit.com/docs/api/accounting/invoice</a></p>
  
  <p>I therefore need to connect via the base URL. Now, this is an app I'm using just to connect to my own company account. I generated all the credentials via the oAuth Playground and manually renew every 180 days. This is what I tried:</p>
  
  <pre><code>$url = "https://quickbooks.api.intuit.com/v3/company/123456/invoice/8661/pdf";
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("OAuth   oauth_token:*******", 
                                              "oauth_nonce:******",
                                              "oauth_consumer_key:*****", 
                                              "oauth_signature_method:HMAC-SHA1",
                                              "oauth_timestamp:1461326602",
                                              "oauth_version:1.0",
                                              "oauth_signature:******"));
  curl_setopt($curl, CURLOPT_VERBOSE, TRUE);
  $result = curl_exec ($curl);
  print $result;
  </code></pre>
  
  <p>This is the response:</p>
  
  <pre><code>&lt; HTTP/1.1 400 Illegal character 0x20
  &lt; Server: nginx
  &lt; Date: Fri, 22 Apr 2016 11:58:59 GMT
  &lt; Content-Length: 0
  &lt; Connection: keep-alive
  &lt; Keep-Alive: timeout=5
  </code></pre>
  
  <p>I don't even know if I'm using all the correct keys and tokens. I used the same values I successfully used for the PHP SDK to work.</p>
  
  <p>I'd appreciate if someone can advise me what I'm doing wrong. Thanks.</p>