D_R
D_R

Reputation: 4972

Weird XMLReader error (Only on host, local its working)

ERRORS:

[xmlreader.open]: failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/html/www/main_web_mobile/index.php on line 54

Warning: XMLReader::open() [xmlreader.open]: Unable to open source data in /var/www/html/www/main_web_mobile/index.php on line 54

Warning: XMLReader::read() [xmlreader.read]: Load Data before trying to read in /var/www/html/www/main_web_mobile/index.php on line 59

CODE:

<?      $z = new XMLReader;
        $z->open('http://URL_HERE');

        $doc = new DOMDocument;

        while ($z->read() && $z->name !== 'item');

        while ($z->name === 'item')
        {
            $node = simplexml_import_dom($doc->importNode($z->expand(), true));
            ?>
            <h2 class="acc_trigger"><a href="#"><?php echo $node->title; ?> | <strong><?php echo $node->speciality; ?></strong></a></h2>
            <div class="acc_container">
                <div class="main_text">
                    <div class="title"><?php echo $node->title; ?> |<strong> <?php echo $node->speciality; ?></strong></div>
                    <div class="text_holder"><?php echo $node->descriptionWithoutImage; ?></div>
                    <div class="img_holder"><img src="<?php echo $node->image; ?>" alt="" /></div>
                </div>
               <a href="tel: <?php echo $numberbefore; ?>"><div class="btn_holder"><?php echo $number; ?><br /><div class="call_now"><div class="extention"><?php echo $node->internalNumber; ?></div></div></div></a>
            </div>
            <?php 
            $z->next('item');
        }
        ?>

Upvotes: 0

Views: 3408

Answers (2)

Burhan Khalid
Burhan Khalid

Reputation: 174662

From the error it is clear that http://URL_HERE is not accessible from your server. Either you have network restrictions; or allow_url_fopen is disabled on your server.

Upvotes: 2

orion78fr
orion78fr

Reputation: 186

Do you have access to your file when you type http://URL_HERE in your browser?

The problem might be access restrictions on your host, try to change chmod for example.

Upvotes: 0

Related Questions