tags:

views:

350

answers:

2

I built a site using simpleXML to pull content from XML pages.

I just switched the site to the client server and the pages that pull from the XML sheet don't work anymore.

Testing server was PHP version 5.2.9

Client server is PHP version 5.2.5

allow_url_fopen is on for both servers.

Any ideas?

class award{
 var $xml;
 var $awards;

 function titles(){

  $this->fullArticle();
  $xml=simplexml_load_file("awards.xml");

  foreach($xml->award as $currentAward){
   $titles=$currentAward->title;
   echo '<li><a href="'; 
   base_url();
   echo 'about/awards.php?award=';
   echo $titles; 

   echo '">' . str_replace(array('<h1>','</h1>'), '', $currentAward->$titles->h1->asXML()) . '</a></li>';
   }

 }

 function fullArticle(){

  $awards=array();
  $xml=simplexml_load_file("awards.xml");

  foreach($xml->award as $currentAward){
   array_push($awards, $currentAward->title);
  }

  return($awards);

 }


 function articleBlock($awardy){


  $xml=simplexml_load_file("awards.xml");

  foreach($xml->award as $currentAward){
   if($currentAward->title = $awardy ){ 
    echo str_replace(array('<'.$awardy.'>','</'.$awardy.'>'), '', $currentAward->$awardy->asXML());
   } 

   }


 }
}
+1  A: 

Add more error handling and debug code

<?php
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_BAIL, 1);
assert_options(ASSERT_QUIET_EVAL, 1);
error_reporting(E_ALL);
ini_set('display_errors', 1);

class award {
    function titles() {
     $xml=simplexml_load_file("awards.xml");
     if (!$xml) {
      throw new Exception("cannot read awards.xml");
     }

     assert( isset($xml->award) );

     foreach($xml->award as $currentAward) {
      assert( isset($currentAward->title) );
      assert( isset($currentAward->$titles) );
      assert( isset($currentAward->$titles->h1) );

      $titles=(string)$currentAward->title;
      echo '<li><a href="';
      base_url();
      echo 'about/awards.php?award=';
      echo urlencode($titles);

      echo '">' . str_replace(array('<h1>','</h1>'), '', $currentAward->$titles->h1->asXML()) . '</a></li>';
     }
    }
VolkerK
thx i never do this but know i should and now will :)
chris
A: 

Please check if your IP address permission is enable on your server. if not then enable it.

Janail