Hi, all,

The question is concerning a feedback String from a web-service.

"approved=yes&error=&authnumber=025968&transactionnumber=313869"

As you c, the String contains four parameters..

I explode it first by "&".
$execoutput = "approved=yes&error=&authnumber=025968&transactionnumber=313869";
$execoutput_array = explode("&", $execoutput);


I secondly explode every parameter=value string by "="..

for (@reset($execoutput_array); list($key,$value)[EMAIL PROTECTED]($execoutput_array);)
{
#output the result for debugging
$value_array = explode("=", $value);
for (@reset($value_array); list($key1,$value1)[EMAIL PROTECTED]($value_array);)
{
$first = $value1;
list($key1,$value1)[EMAIL PROTECTED]($value_array);
$second = $value1;


     if($first == "approved")
     {
       $approved = $second;
     }
     if($first == "error")
     {
       $error = $second;
     }
     if($first == "authnumber")
     {
       $authnumber = $second;
     }
     if($first == "transactionnumber")
     {
       $transactionnumber = $second;
     }
   }
 }

However, this way looks quite ugly.. I expect to get a concise code.. could you pls help me?


with best wishes


Zheng Sun

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to