I want to read in a XML on the internet,
for example the address of XML is [
test...]
I don't know what's the best way in reading XML with PHP,so I choose the open function to open that address,
it echo success, I think I can open it.
but nothing come out when I echo the $contents!
the return of echo "$fp" is
"successResource id #3 "
Have I already read it in my program?
Or there is some other functions better than open function in reading XML?
How can I read the XML on the web and phrase it?
Thanks a lot!
my code
////////////////////////////////
$open_url='http://test/test.xml';
$fp = fopen ($open_url, "r");
if($fp)
{
echo "success";
echo "$fp";
}
else {
echo "fail";
}
$contents = '';
while (!feof($fp)) {
$contents .= fread($fp, 8192);
}
echo "$contents";