Fwd: Help! Reading from stdin
| From: | David G. Simmons | Date: | Wed, 14 Apr 2004 01:13:35 +0000 |
| Subject: | Fwd: Help! Reading from stdin | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-183275@lists.php.net to get a copy of this message | ||
Fort some reason it looks as if this message never got posted with a body ...
dg
Begin forwarded message:
Attachment: [text/enriched]
Attachment: [application/pkcs7-signature] smime.p7s
From: David G. Simmons <santafen@mac.com> Date: April 13, 2004 5:16:40 PM PDT To: php-general@lists.php.net Subject: Help! Reading from stdin Please respond directly, as I'm only on the digest and need an answer ASAP! I'm trying to read a file (currently sent to me via curl) and am having trouble. It worked once or twice, but not anymore. The curl command could be either: curl --data-binary <file-name> http://hostname/reader.php OR curl http://hostname/reader.php -T <file-name> Neither seem effective. I have tried (all from the php online docs): if(!isset($GLOBALS['StdinPointer'])){David G. Simmons Calvin Says: "I never get to do anything fun." -Calvin$GLOBALS['StdinPointer'] = fopen("php://stdin", "r");} else die("Don't have stdin!\n"); And it does not die. So stdin is open. BUT: do {$data = fread($GLOBALS['StdinPointer'], 8192); $data = fread($fpf, 8192); if (strlen($data) == 0) { echo "got no data!\n"; break; } $contents .= $data; echo $data; } while (true);gets NOTHING. So I tried:if($DEBUG) echo "_FILES: " . print_r($_FILES); echo "Userfile: " . $_FILES['userfile'] . "\n"; if($DEBUG) echo "HTTP_POST_FILES: " . print_r($HTTP_POST_FILES); $uploaddir = '/tmp/'; $uploadfile = $uploaddir . $_FILES['userfile']['name']; move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);Thinking maybe the file was being sent as a POST ... but this ALSO gets nothing ... I cannot figure out what's wrong, and would appreciate ANY help!!! dg -- David G. Simmons Calvin Says: "No, thanks. I'm trying to reach middle age." -'Dad' --
Attachment: [text/enriched]
Attachment: [application/pkcs7-signature] smime.p7s