title: Bad request using file_get_contents for PUT request in PHP
body: <p>This api call works fine using Postman (a REST Client),
  but when making the request on the server in my GAE application I am currently getting the following error:</p>
  
  <blockquote>
    <p>HTTP request failed! in C:\Projects\app\file.php on line 26</p>
    
    <p><strong>failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in C:\Projects\app\file.php on line 26</strong></p>
  </blockquote>
  
  <p>Here is the code from my application, which makes a call to the rest api method /exampleMethod</p>
  
  <pre><code>$dataraw = [ 
          'email' =&gt; 'email@ex.com',
          'first_name' =&gt; 'firstname',
          'last_name' =&gt; 'lastname',
          'fEmail' =&gt; 'email@ex.com',
          'message' =&gt; 'test' 
  ];
  $data = http_build_query ( $dataraw );
  $context = [ 
          'http' =&gt; [ 
                  'method' =&gt; 'PUT',
                  'header' =&gt; "Authorization: apikeystring\r\n" . "Content-Length: " . strlen($data) . "\r\n" . "Content-Type: application/json\r\n",
                  'content' =&gt; $data,
                  'proxy' =&gt; 'tcp://euproxy.example.com:0000' 
          ] 
  ];
  $context = stream_context_create ( $context );
  $result = file_get_contents ( $GLOBALS ['REST_API_URL'] . '/exampleMethod', false, $context );
  </code></pre>
  
  <p>In the application I have successfully used file_get_contents for GET requests, but with this PUT request I am getting a 400 bad request which is not coming from the Rest Api. </p>