I am trying to grab certain attributes from an xml page. It works fine on my own desktop comp with a localhost server. When I upload to my website, which uses mySQL, it fails. I am new to php and seem to be stuck because it doesn't output an error.
Here is the code: (this was copy/pasted from somewhere on the net and edited by me to fit my needs)
Code:
$xml = new XMLReader();
$xml->open($new_link); // Declare and open the xml file
$xml->setParserProperty(2,true); // This seems a little unclear to me - but it worked :)
while ($xml->read()) {
echo 'test1';
switch ($xml->name) {
case "name":
$xml->read();
$conf["name"] = $xml->value;
$item_name = $conf["name"];
echo $item_name;
$xml->read();
break;
case "quality":
$xml->read();
$conf["quality"] = $xml->value;
$raw_quality = $conf["quality"];
if ($raw_quality == 'Common')
$item_quality = 1;
elseif ($raw_quality == 'Uncommon')
$item_quality = 2;
elseif ($raw_quality == 'Rare')
$item_quality = 3;
elseif ($raw_quality == 'Epic')
$item_quality = 4;
elseif ($raw_quality == 'Legendary')
$item_quality = 5;
else
$item_quality = 0;
$xml->read();
break;
case "subclass":
$xml->read();
$conf["subclass"] = $xml->value;
$item_subclass = $conf["subclass"];
echo $item_subclass;
$xml->read();
break;
case "inventorySlot":
$xml->read();
$conf["inventorySlot"] = $xml->value;
$item_slot = $conf["inventorySlot"];
echo $item_slot;
$xml->read();
break;
case "link":
$xml->read();
$conf["link"] = $xml->value;
$item_link = $conf["link"];
echo $item_link;
$xml->read();
break;
echo "$xml->read()";
}
}
$xml->close();
After this, my code grabs the new $item_xxxx variables and inserts them into the database. Even if I try to echo the variables after this XML Reader, they won't show. Again, I have no issues on my home computer with localhost server. Is there something I am missing? Or is there abetter way to do this?