(this code not tested) <? $res_arr = explode("\n", $result); $res_num = count($res_arr); for ($i = 0; $i < $res_num; $i++) { list($k, $v) = explode("=", $res_arr[$i]); $$k = $v; } ?>
this isn't going to work properly if the "value" part has an "=" in it - in that case, change the explode("=", ...) line to use strtok() or strpos()/substr() HTH Martin -----Original Message----- From: Keith Posehn [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 9:22 AM To: [EMAIL PROTECTED] Subject: [PHP] Curl output to an array -- HELP!! -- Appended This is an revision of my previous message: Ok, lets say I have some code here: $result = array(); $ch = curl_init ("https://www.myverificationplace.com/verify.asp"); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, $args); curl_setopt ($ch, CURLOPT_TIMEOUT, 120); // Set the timeout, in seconds. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close ($ch); Now that we see that, how can I make it so that the output from curl, which is in the variable $result, will be an array, for each line of output? Some of the line of output looks like this: ssl_result_message=APPROVED ssl_txn_id=00000000-0000-0000-0000-000000000000 ssl_approval_code=000000 I need each of the lines to be turned into a variable. Example: name the variable 'ssl_result_message', the value being 'APPROVED' Any ideas as to how I might go about this? Thanks, Keith Posehn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php