Hi, I'm trying to modifiy a XML document with this fuction:
function modifyXML($itemid, $itemrating){
$source = 'vids.xml';
$dom = new DomDocument();
$dom->load($source);
$xpath = new DomXPath($dom);
$itemfound = false;
$itemindex = 0;
$index = 0;
$idnumbers = $xpath->query("//video/videoid/text()");
foreach($idnumbers as $i) { //Search and get correct element index
if($i->data == $itemid){
$itemindex = $index;
$itemfound = true;
}
$index++;
}
if($itemfound == true){ //Modify node
$result = $xpath->query("//video/rating/text()");
echo $result->item($itemindex)->data." is the items rating";
$node = $result->item($itemindex);
$node->data = $itemrating; //This line causes the problem
$dom->saveXML();
}
}
However I am getting the following error:
ERROR - The requested URL could not be retrieved
While trying to retrieve the URL: My_page_url
The following error was encountered:
* Zero Sized Reply
Squid did not receive any data for this request.
If I remove the line:
$node->data = $itemrating;
All works fine, but does not modify the XML. I have the correct permissions set for the XML as I can modify it else where. I have tried assigning diffferent values and types to $node->data without any luck. The XML file is in the same domain and folder as the php file that is modifying it.
The url does not change at any time but with the line
$node->data = $itemrating; there the error "The requested URL could not be retrieved" exists. Why does that line of code cause this error?
I have placed
error_reporting(E_ALL);
ini_set("display_errors", 1);
At the top of the code and it does not display anything.
I'm very stuck on this one and any help or alternate methods to modify a XML nodes value would really be appreciated
Cheers
Cam