Hi,

I am trying to read variables from input method.
I am using this tuorial:
http://www.lornajane.net/posts/2008/Accessing-Incoming-PUT-Data-from-PHP.
Here is my code:
<?php
if($_SERVER['REQUEST_METHOD'] == 'GET') {
    echo "this is a get request\n";
    echo $_GET['fruit']." is the fruit\n";
    echo "I want ".$_GET['quantity']." of them\n\n";
} elseif($_SERVER['REQUEST_METHOD'] == 'PUT') {
    echo "this is a put request\n";
    parse_str(file_get_contents("php://input"),$post_vars);
    echo $post_vars['fruit']." is the fruit\n";
    echo "I want ".$post_vars['quantity']." of them\n\n";
}
?>

I am using the firefox extension  "poster" to run this example. GET
works fine but when using PUT, file_get_contents("php://input")
returns an empty string.

I found a bug related to this: https://bugs.php.net/bug.php?id=51592

I am using xampp on win7 (
+ Apache 2.2.17
  + MySQL 5.5.8 (Community Server)
  + PHP 5.3.5 (VC6 X86 32bit) + PEAR)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to