Page 1 of 1

Zero Sized Reply error.

Posted: Sat Feb 14, 2009 8:52 pm
by mrwelcam
Hi, I'm trying to modifiy a XML document with this fuction:

Code: Select all

 
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: http://www...../rate.php
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. The url does not change at any time. Why does that line of code cause this error?

Any help on this one would really be appreciated

Cheers

Cam

Re: Zero Sized Reply error.

Posted: Sat Feb 14, 2009 11:27 pm
by JAB Creations
By the looks of it if you're trying to get the contents of a file on a different domain name I recommend having a look at cURL. :)

Re: Zero Sized Reply error.

Posted: Sun Feb 15, 2009 12:02 am
by mrwelcam
Thanks for trying to help me out on this one. The xml file is in the same domain and folder as the php file that is modifying it. Changing the $source to the complete url of the XML file did not solve the problem either.

Cheers

Cam