title: FreeAgent oAuth2 can't update contact using Light PHP wrapper
body: <p>I’m having problems creating a new contact in FreeAgent.</p>
  
  <p>I’m using the Light PHP wrapper for the OAuth 2.0 protocol and have managed to successfully set up oAuth2. I can connect to FreeAgent and successfully retrieve a list of customers. So far, so good. The problem I’ve got is sending data back the other way, i.e. creating a new contact in FreeAgent.</p>
  
  <p>Here’s some code I’ve tried:</p>
  
  <pre><code>require_once($_SERVER['DOCUMENT_ROOT'].'/OAuth2/Client.php');
  require_once($_SERVER['DOCUMENT_ROOT'].'/OAuth2/GrantType/IGrantType.php');
  
  $client = new OAuth2\Client($clientid, $secret);
  
  $params = json_encode(array('contact' =&gt; array('first-name' =&gt; $firstname_unencrypted, 'last-name' =&gt; $surname_unencrypted)));
  
  $response = $client-&gt;fetch("/contacts", $params, "POST", array('User-Agent' =&gt; 'MyApp', 'Accept' =&gt; 'application/json', 'Content-type' =&gt; 'application/json'));
  
  var_dump($response);
  </code></pre>
  
  <p>The var_dump returned shows:</p>
  
  <pre><code>array(3) {
    ["result"]=&gt;
    bool(false)
    ["code"]=&gt;
    int(0)
    ["content_type"]=&gt;
    bool(false)
  }
  </code></pre>
  
  <p>I’m pretty sure I’m doing something silly. I’ve tried sending in XML instead of JSON. I’ve tried using just a single array of params rather than the array in an array I’ve got in the sample. I’m going round in circles!</p>
  
  <p>If someone could give me a little nudge in the right direction, I’d be eternally grateful!</p>