title: HTTP request failed! HTTP/1.1 400 Bad Request
body: <p>I am trying to create a issue in Jira .</p>
  
  <p>I am able to make a GET request with a proper response, but the problem arises when i make a POST request.Here is the code.</p>
  
  <pre><code>&lt;?php
  
  $userName ='xxxxxxxxxxxxxxxx';
  $password ='xxxxxxxxxxxx';
  
  $data = ['fields' =&gt; ['projects'=&gt;['key'=&gt;'ABC'],'summary'=&gt;'abc','description'=&gt;'abc','issuetype'=&gt;['name'=&gt;'Task']]];
  
  $data = http_build_query($data);
  $context = 
       array("http"=&gt;
          array(
              "method" =&gt; "POST",
                  "header" =&gt; "Authorization: Basic " . base64_encode($userName.':'.$password) . "\r\n".
                  'Accept: application/json'."\r\n".
                  "Content-Length: ".strlen($data)."\r\n".
                      'Content-Type: application/json'."\r\n",
              'content' =&gt; $data,
              'verify_peer'=&gt;false,
              'verify_peer_name'=&gt;false,
              )
              );
  $context = stream_context_create($context);
  $result = file_get_contents("https://xxxxx.atlassian.net/rest/api/2/issue/", false, $context);
  echo "The result is ", $result;
  </code></pre>
  
  <p>?></p>
  
  <p>I get the following error:</p>
  
  <pre><code>Warning:file_get_contents(https://xxxxx.atlassian.net/rest/api/2/issue/):
  failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in
  /var/www/html/test/new.php on line 27
  </code></pre>
  
  <p>Could any one help me out? Thanks</p>
  
  <p>P.S</p>
  
  <p>I dont want to use curl as an alternative to http-streams as google app engine does not support curl.</p>