php search xml-file
| From: | Jan Grafström | Date: | Mon, 09 Apr 2001 06:57:30 +0000 |
| Subject: | php search xml-file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47732@lists.php.net to get a copy of this message | ||
Hi!
I have this xml:
<list>
<vara>car</vara>
<bskr>ford</bskr>
<price>3600</price>
<nr>8888</nr>
</list>
---------
and this php:
$filename = "list.xml";
$fp = fopen($filename, "r");
$string = fread($fp, filesize($filename));
$string = strip_tags($string);
$refined_string = explode(" ", $string);
if (in_array($needle." ", $refined_string)) {
print "found";
} else {
print "notfound";
}
fclose ($fp);
-------
I always get notfound when I set $needle to a word inside the xml-file.
My script doesn´t work.
Is it possible also to write a script wich can find the word "ford" if
You only ask for "for"?
I have just started to learn about php search and I am very thankful for
any help.
Regards
Jan