Re: Clearing pipe stream and a few other issues.

From: Date: Fri, 17 Feb 2006 01:27:01 +0000
Subject: Re: Clearing pipe stream and a few other issues.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230611@lists.php.net to get a copy of this message
<? $fp=popen("cat","r"); $str=fgets($fp); pclose($fp); print $str; $arr = array(); foreach (explode('&', $str) as $v) { $split = explode('=', $v); // urldecode content for readability $arr[$split[0]] = urldecode($split[1]); // create assoc. array ${$split[0]} = urldecode($split[1]); // form the variables } //echo $sender_name . '<br/>' . $arr['sender_name']; print_r($arr); $msg = "Sender's Full Name: $sender_name\n"; $msg .= "Sender's E-Mail: $sender_email\n"; $msg .= "Secret Message? $sender_msg\n\n"; ?>
What exactly are you trying to achieve and what problems were you having using it as a normal script? I'm guessing it's some form of a mailing script. What's wrong with using a regular php script with a mail command: <?php $sender_name = htmlentities($_POST['sender_name']); $sender_email = htmlentities($_POST['sender_email']); $sender_msg = htmlentities($_POST['sender_msg']); $msg = "Name: $sender_name\n"; $msg .= "Email: $sender_email\n"; $msg .= "Message: $sender_msg\n"; mail('........'); ?> and then your form posts to this script (change the form action to point to this new file)...

« previous php.general (#230611) next »