Help! Reading from stdin

From: Date: Wed, 14 Apr 2004 00:16:40 +0000
Subject: Help! Reading from stdin
Groups: php.general 
Request: Send a blank email to php-general+get-183273@lists.php.net to get a copy of this message
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'])){
        $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: [application/pkcs7-signature] smime.p7s
« previous php.general (#183273) next »