0

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');
        }
        ?>
D_R
  • 4,894
  • 4
  • 45
  • 62
  • Contact your host, that might be an issue on their PHP configuration. Try with `file_get_contents` (or `fopen`) first to provoke the same error. If that doesn't give you the error, probably download the file first and then open from disk (temporary file). – hakre Jul 22 '13 at 12:57

2 Answers2

2

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.

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
0

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.

orion78fr
  • 166
  • 2
  • 8
  • Yes, I do have access. its only a remote server. and it's working on my Local enviorment. and on the php version on the host is 5.2 so I guess its not the php version issue – D_R Jul 22 '13 at 12:14
  • So it's strange that you have a code 500 error on your request... Do you have some right restriction on your host? Such as not being able to open HTTP streams? It may be related to http://stackoverflow.com/q/4608788/2500474 – orion78fr Jul 22 '13 at 12:23