URGENT! Regarding PHP and qmail-remote (another issue)

From: Date: Sun, 07 Jan 2001 19:30:48 +0000
Subject: URGENT! Regarding PHP and qmail-remote (another issue)
Groups: php.general 
Request: Send a blank email to php-general+get-33109@lists.php.net to get a copy of this message
HI ppl! Please help ASAP, this is realy urgent! I have trouble with the following piece of code: <?php //part 1 $fpout = popen("qmail-remote ptt.yu sender@wherever.com ndjuric.nospam@ptt.yu", "w"); fputs($fpout, "From: sender@wherever.com\n"); fputs($fpout, "To: skaarj@eunet.yu\n"); fputs($fpout, "Subject: Mail test\n"); fputs($fpout, "\n"); fputs($fpout, "Body of the message\n"); fputs($fpout, "\n"); pclose($fpout); // part 2 // try to capture standard output from qmail-remote $fpin = fopen("php://stdin", "r"); // just checking result $c=fread($fpin, 3); print "$c\n"; // formating according to my needs $c1=substr($c,0,1); $c2=substr($c,2); print "$c1\n"; print "$c2\n"; // here should go some aditional code ?> Explanation: I'm trying to send e-mail using qmail-remote. (part 1 of the script) and that is doing OK. But, when I try to capture the output of the qmail-remote, script hangs. I must wait qmail-remote to terminate because I need its output for further code. Without part 2 of the script runs perfectly, send mail then exits. If I do something like script.php > msg.file I recieve adequate output (binary data by the way) in file. But I just can't capture live data stream. If I try something like script.php | script2.php it doesn't work either! I've tried exec(), PassThru(), backtick operator(``), and everything else in manual, but only popen() is adequate for running qmail-remote. PHP is used as standalone executable, version is 4.01pl2. It should be easy but somwhere is an error. I just can't figure this one out. Any suggestions? 10x in advance Nemanja NOTE: My email is incorrect. Please remove nospam part.

« previous php.general (#33109) next »