Read from STDIN

From: Date: Fri, 24 Nov 2000 15:16:12 +0000
Subject: Read from STDIN
Groups: php.general 
Request: Send a blank email to php-general+get-26968@lists.php.net to get a copy of this message
Hi all. I'm triyng to get the form POST data directly from STDIN, but the fopen() function crash with the following error: Warning: fopen("php://stdin","r") - Bad file number in /path/formmail.php on line 121 Well, I don't know how to work correctly with this. The code that I use is: if (!strcasecmp($REQUEST_METHOD, "GET")) { $dados = explode("&", $QUERY_STRING); foreach($dados as $d) echo "$d<br>"; } elseif (!strcasecmp($REQUEST_METHOD, "POST")) { if (!($buffer = fopen("php://stdin", "r"))) { echo "Erro ao ler o conteudo dos dados enviados"; exit(); } foreach($buffer as $b) echo "$b<br>"; } Someone have and idea??? thanks Rafael Steil

« previous php.general (#26968) next »