Craig Westerman <[EMAIL PROTECTED]> wrote:
> I'm just now trying to learn PHP. I don't know ANYTHING about XML. I don't
> even have any XML reference books yet. I did create a PHP script that is
> usable (see below), but there has to be a more efficient way to do it with
> PHP. I'll hunt up your post on XML in the archives after I get a XML book.

the example you provided isn't xml. (it has some resemblance, but it isn't
xml.) here's a code snippet that will turn that format into an array:

$fp = fopen($url,"r");
if (!$fp) die("could not open URL");
$out = array();
while (!feof($fp)) {
  $line = fgets($fp,512);
  if (preg_match('!<(\w+?)>(.*?)</\1>!', $line, $m)) {
    $out[$m[1]] = $m[2];
  }
}
fclose($fp);

print_r($out);

jim

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

Reply via email to