title: Httpful post with urlencode
body: <p>I have a little laravel app and I added the <a href="http://phphttpclient.com/" rel="nofollow">http://phphttpclient.com/</a> - httpful REST Client to work with an external api - <a href="http://en.help.mailstore.com/spe/Management_API_-_Using_the_API" rel="nofollow">http://en.help.mailstore.com/spe/Management_API_-_Using_the_API</a></p>
  
  <p>I was able to "speak" with the mailstore api. Here is one example:</p>
  
  <pre><code>public function GetEnvironmentInfo()
  {
      $uri = 'https://bla.com:8474/api/invoke/GetEnvironmentInfo';
      $response = Httpful::post($uri)             
  
          -&gt;authenticateWith('admin', 'password')  
          -&gt;send();  
      $errors = $response-&gt;body-&gt;error;
      $version = $response-&gt;body-&gt;result-&gt;version;
      $license = $response-&gt;body-&gt;result-&gt;licenseeName;
          dd($version . $license . $errors);
  }
  </code></pre>
  
  <p>That function works. But I have a problem when I try to send additional data to the api.</p>
  
  <p>In the manual of the api you can find the following sentences.</p>
  
  <p>"When a function needs additional data, this data must be send urlencoded. The HTTP header Content-Type: application/x-www-form-urlencoded should be set."</p>
  
  <p>For example I want to set the user password with the help of the api. </p>
  
  <p>SetUserPassword</p>
  
  <p>Set password of MailStore user.</p>
  
  <p>Arguments
  Name     Type    Description
  instanceID   string  Unique ID of MailStore instance in which this command is invoked.
  userName     string  User name of MailStore user.
  password     string  Password of MailStore user.</p>
  
  <p>I tried this code.</p>
  
  <pre><code>public function SetUserPassword()
  {
      $uri = 'bla.com:8474/api/invoke/SetUserPassword';
      $response = Httpful::post($uri)             
  
          -&gt;authenticateWith('admin', 'password') 
          -&gt;addHeaders(array(
              'instanceID' =&gt; 'bla',
              'userName' =&gt; 'myuser',
              'password' =&gt; 'mypassword'
              ))
          -&gt;sendsType(\Httpful\Mime::FORM)
          -&gt;send();  
          dd($response-&gt;body-&gt;error);
  }
  </code></pre>
  
  <p>And here is the error response i get:</p>
  
  <pre><code>object(stdClass)[142]
    public 'message' =&gt; string 'Argument instanceID is missing.' (length=31)
    public 'details' =&gt; string 'System.Exception: Argument instanceID is missing.
    bei #Y3c.#VGc.#X3c(#ncb #tPc, #8xe #I9f, String #GPf, NameValueCollection #P5b, Int32     #joc)
     bei #Y3c.#VGc.#Slc(#LLc #Rmc, #8xe #I9f)
  ' (length=192)
  </code></pre>
  
  <p>I added the instanceID and the other arguments to the header, but the api can't find the arguments or values.</p>
  
  <p>I think the problem is the urlencode? Can you help me?</p>
  
  <p>Thanks!</p>