Zero Sized Reply error.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrwelcam
Forum Newbie
Posts: 2
Joined: Sat Feb 14, 2009 8:37 pm

Zero Sized Reply error.

Post 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
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: Zero Sized Reply error.

Post 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. :)
mrwelcam
Forum Newbie
Posts: 2
Joined: Sat Feb 14, 2009 8:37 pm

Re: Zero Sized Reply error.

Post 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
Post Reply