title: Guzzle 401 Unauthorized using post method
body: <p>I wanted to convert all my api calls using Guzzle 6.0(before was with curl_multi). however When I make a post request it comes with Unauthorized response.</p>
  
  <p>Working:</p>
  
  <pre><code>$url = "http://192.168.101.10/WebConnect/search.asp?";
  $request_data = 'CID=test&amp;PWD=test&amp;ORD=;0451103144;;1;;';
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $request_data);
  
  $reply = curl_exec($ch);
  if (curl_errno($ch)) {
     print curl_error($ch);
  } else {
     echo '&lt;pre&gt;';
     print_r($reply);
     echo '&lt;/pre&gt;';
  }
  curl_close($ch);
  </code></pre>
  
  <p>using  Guzzle 6.0</p>
  
  <pre><code>    $client = new Client();
      $res = $client-&gt;post($url, [
           'timeout' =&gt; 30,
           'body' =&gt; $request_data,
      ]);
  
      echo $res-&gt;getStatusCode();
      echo $res-&gt;getHeader('content-type');
      echo $res-&gt;getBody();
  </code></pre>
  
  <blockquote>
    <p>Error:</p>
    
    <p><strong>Client error: <code>POST http://192.168.101.10/WebConnect/search.asp?</code> resulted in a <code>401 Unauthorized</code> response:</strong></p>
  </blockquote>
  
  <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xml (truncated...)
  </code></pre>
  
  <p>I tried with </p>
  
  <pre><code>'auth' =&gt; ['test','test'] //doesnot work either
  </code></pre>
  
  <p>Also I tried to add headers but it doesnot work same error </p>
  
  <pre><code>$headers = array(
      'Content-type' =&gt; 'text/plain;charset="utf-8"',
      'Accept' =&gt; 'text/plain',
      'Content-length' =&gt; strlen($test)
  );
  </code></pre>
  
  <p>and also with </p>
  
  <pre><code>    $headers = array(
          'Accept' =&gt; 'text/html',
          'Content-Type' =&gt; 'text/html',
      );
  </code></pre>
  
  <p>and also i tried to submit the separate the params </p>
  
  <pre><code>$requestBody = array(
       'CID' =&gt; 'test',
       'PWD' =&gt; 'test',
       'ORD' =&gt; ';0451103144;;1;'
   ); 
  
   $request = $client-&gt;post($url,
      array(
      'headers' =&gt; $headers,
      'form_params' =&gt; $requestBody
     ));
  </code></pre>
  
  <p>Why does it says <code>&lt;html xml (truncated...)</code> xml..?? When I specifically mentioned its a <code>text/plain</code> or <code>text/html</code></p>