Post by iMathias
Hi,
I was wondering why I can't seem to be able to read the wowhead xml pages.
I'm used to use the
SimpleXMLElement function to read my xmls so...
$xmlHandle = new SimpleXMLElement(file_get_contents($xmlLink));
to handle my xml files where $xmlLink is respectivly:
$xmlLink = "
http://www.wowhead.com/?item=46017&xml"however PhP doesnt seem to be able to parse it as Xml. Any ideas how to solve it?
Edit: n.v.m. I made a typo >.<
Edit 2: In case someone's still wondering here's a little function:
function setGp($charname,$itemId){
// Fetch GP based on item lvl from Wowhead
$xmlLink = "
http://www.wowhead.com/?item=".$itemId."&xml";
$xmlHandle = new SimpleXMLElement(file_get_contents($xmlLink));
$gp = $xmlHandle->item->level;
$q = "INSERT INTO tbl_name (character_name,gp_earned,item_gained) ";
$q.= "VALUES ('".$charname."', '".$gp."', '".$itemId."')";
mysql_query($q);
}