RE: [PHP] Converting piped data to values from html to phpcgi

From: Date: Mon, 13 Feb 2006 16:02:27 +0000
Subject: RE: [PHP] Converting piped data to values from html to phpcgi
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-230317@lists.php.net to get a copy of this message
This works for me: <? $temp = 'sender_name=zedleon&sender_email=support@passeycorp.com& sender_msg=This+is+a+test&Submit=Submit'; $arr = array(); foreach (explode('&', $temp) 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']; ?> That routine should create variables with the names of the arguments as well as an associative array of the string HTH Dan -----Original Message----- From: zedleon [mailto:support@passeycorp.com] Sent: 13 February 2006 14:38 To: php-general@lists.php.net Subject: [PHP] Converting piped data to values from html to phpcgi I am using php as a cgi. The data from my html is piped through stdin using this code: <? $fp=popen("cat","r"); $str=fgets($fp); print $str; ?> The result I am getting looks like this: (which is correct) sender_name=zedleon&sender_email=support@passeycorp.com&sender_msg=This+is+a +test&Submit=Submit What I need to do now is to convert the piped string into the individual values $sender_name, $sender_email, $sender_msg. Does anybody know a way to do this...any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#230317) next »