title: PHP JSON Error when using Basic Authentication
body: <p>I'm new to PHP and I'm trying to send a JSON request via basic authentication. The server responds with this error:</p>
  
  <pre><code> object(stdClass)#1 (2) { ["error"]=&gt; object(stdClass)#2 (2) {  
   ["code"]=&gt; int(-32600) ["message"]=&gt; string(44) "expected content type 
   to be application/json" } ["jsonrpc"]=&gt; string(3) "2.0" } 
  </code></pre>
  
  <p>From the API documentation, here is the request format:</p>
  
  <pre><code>  Request Format:
  
    {
        "jsonrpc": "2.0",
         "id":1,
         "method": "acct.name.get",
         "params": [
               "QrOxxEE9-fATtgAD" ]
    }
  </code></pre>
  
  <p>Here is the code...Any help would be great - thanks</p>
  
  <pre><code> &lt;?php
  
   $username = "username";
   $password = "password";
  
   $request = [
      'jsonrpc' =&gt; '2.0',
      'id' =&gt; 1,
      'method' =&gt; 'acct.name.get',
      'params' =&gt;['CA6ph0n7EicnDADS'],
   ];
  
   $curl_post_data = json_encode($request);
  
   $service_url = 'https://userapi.voicestar.com/api/jsonrpc/1';
   $curl = curl_init($service_url);
   curl_setopt($curl, CURLOPT_URL, $service_url);
   curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
   curl_setopt($curl, CURLOPT_USERPWD,  "username:password");
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($curl, CURLOPT_POST, true);
   curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
   curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
   $curl_response = curl_exec($curl);
   $response = json_decode($curl_response);
   curl_close($curl);
  
   var_dump($response);
  
  ?&gt;
  </code></pre>