note 39459 added to function.curl-exec

From: Date: Thu, 29 Jan 2004 11:35:36 +0000
Subject: note 39459 added to function.curl-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-64365@lists.php.net to get a copy of this message
If you get a string of an array back from curl_exec you can use this piece of code to make variables from the array keys: $ignore = array('Array','(',')',''); $matches = preg_split("/\n/", $CURLresult); foreach ($matches as $key=>$value) { $value = trim($value); if (!(in_array($value,$ignore))) { $vals = preg_split("/=>/", $value); $vals[0] = eregi_replace("\[","",$vals[0]); $param = trim(eregi_replace("\]","",$vals[0])); #echo $param."<br>"; ${$param} = $vals[1]; } } Hope this can help you. ---- Manual Page -- http://www.php.net/manual/en/function.curl-exec.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39459 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39459&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39459&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64365) next »