SimpleXML broke while I was sleeping.
am 11.12.2008 03:12:45 von Nicholas Mercier------=_Part_140791_2209313.1228961565469 ------=_Part_303_7161959.1228961881232 > This is the error message I now get: ------=_Part_141414_1711958.1228966161546 ------=_Part_1417_7792256.1228966324645
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
So I had a code project that took the name of a piece of equipment in World
of Warcraft - pulled the XML from WoWhead and pulled the database item
number from the XML file. It worked for a long while and the code simply sat
around not being used. I went back to pull the project out for inclusion in
something new and it no longer works.
I wasn't terribly comfortable with XML to begin with so I'm not sure what
has changed - but here is the code the worked for so long:
function item_num_from_xml($url)
{
$xml = new SimpleXMLElement(rawurlencode($url), NULL, TRUE);
$item_num = $xml->items->item[id];
return $item_num;
}
$xml_link = "http://www.wowhead.com/?search=".str_replace(" ", "+",
$item)."&xml";
$item_num = item_num_from_xml($xml_link);
$itemlink = "http://www.wowhead.com/?item=".$item_num;
This is the error message I now get:
*Warning*: SimpleXMLElement::__construct()
[simplexmlelement.--construct
http%3A%2F%2Fwww.wowhead.com%2F%3Fsearch%3DAngelista%27s%2BS ash%26xml:84:
parser error : Entity 'nbsp' not defined in *
/home/thered/public_html/test/config.php* on line *28
**Warning*: SimpleXMLElement::__construct()
[simplexmlelement.--construct
pan>
class="moneycopper">64
/home/thered/public_html/test/config.php* on line *28*
and various other beauties including:
*Fatal error*: Uncaught exception 'Exception' with message 'String could not
be parsed as XML' in /home/thered/public_html/test/config.php:28 Stack
trace: #0 /home/thered/public_html/test/config.php(28):
SimpleXMLElement->__construct('http%3A%2F%2Fww...', 0, true) #1
/home/thered/public_html/test/config.php(105): item_num_from_xml() #2
/home/thered/public_html/test/display.php(86): display_drops('
http://www.wowh...') #3 /home/thered/public_html/test/index.php(2):
include('/home/thered/pu...') #4 {main} thrown in *
/home/thered/public_html/test/config.php* on line *28
First person to point out what stupid mistake I'm making can mock me for a
long time.
*
------=_Part_140791_2209313.1228961565469--
Re: SimpleXML broke while I was sleeping.
am 11.12.2008 03:18:01 von Jack van Zanen
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
did they change the source at WoWhead?
2008/12/11 Nicholas Mercier
> So I had a code project that took the name of a piece of equipment in World
> of Warcraft - pulled the XML from WoWhead and pulled the database item
> number from the XML file. It worked for a long while and the code simply
> sat
> around not being used. I went back to pull the project out for inclusion in
> something new and it no longer works.
>
> I wasn't terribly comfortable with XML to begin with so I'm not sure what
> has changed - but here is the code the worked for so long:
>
> function item_num_from_xml($url)
> {
> $xml = new SimpleXMLElement(rawurlencode($url), NULL, TRUE);
> $item_num = $xml->items->item[id];
> return $item_num;
> }
>
> $xml_link = "http://www.wowhead.com/?search=".str_replace(" ", "+",
> $item)."&xml";
> $item_num = item_num_from_xml($xml_link);
> $itemlink = "http://www.wowhead.com/?item=".$item_num;
>
> This is the error message I now get:
> *Warning*: SimpleXMLElement::__construct()
> [simplexmlelement.--construct<
> http://www.theredshirts.com/test/simplexmlelement.--construc t>]:
> http%3A%2F%2Fwww.wowhead.com
> %2F%3Fsearch%3DAngelista%27s%2BSash%26xml:84:
> parser error : Entity 'nbsp' not defined in *
> /home/thered/public_html/test/config.php* on line *28
>
> **Warning*: SimpleXMLElement::__construct()
> [simplexmlelement.--construct<
> http://www.theredshirts.com/test/simplexmlelement.--construc t>]:
> pan>
> class="moneycopper">64
> /home/thered/public_html/test/config.php* on line *28*
>
> and various other beauties including:
>
> *Fatal error*: Uncaught exception 'Exception' with message 'String could
> not
> be parsed as XML' in /home/thered/public_html/test/config.php:28 Stack
> trace: #0 /home/thered/public_html/test/config.php(28):
> SimpleXMLElement->__construct('http%3A%2F%2Fww...', 0, true) #1
> /home/thered/public_html/test/config.php(105): item_num_from_xml() #2
> /home/thered/public_html/test/display.php(86): display_drops('
> http://www.wowh...') #3 /home/thered/public_html/test/index.php(2):
> include('/home/thered/pu...') #4 {main} thrown in *
> /home/thered/public_html/test/config.php* on line *28
>
>
> First person to point out what stupid mistake I'm making can mock me for a
> long time.
> *
>
--
J.A. van Zanen
------=_Part_303_7161959.1228961881232--
Re: SimpleXML broke while I was sleeping.
am 11.12.2008 03:44:00 von dmagick
> *Warning*: SimpleXMLElement::__construct()
> [simplexmlelement.--construct
> http%3A%2F%2Fwww.wowhead.com%2F%3Fsearch%3DAngelista%27s%2BS ash%26xml:84:
> parser error : Entity 'nbsp' not defined in *
> /home/thered/public_html/test/config.php* on line *28
Looks like the xml contains ' ' chars now - which are not valid in
xml context it seems.
Not sure if ' ' is valid but you'll have to work it out. Take
the xml, save it to your desktop, try to show it in IE (if using windows
of course :P). It will show errors. Once you work out how to fix it,
modify your script accordingly.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.phpRe: SimpleXML broke while I was sleeping.
am 11.12.2008 04:29:21 von Nicholas Mercier
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Jack wins the right to call me an idiot for a long time. WoWhead changed
their configuration slightly I think, that is what messed it up. I believe
it is working now. Thank you - I was just convinced it was something dumb on
my end.
On Wed, Dec 10, 2008 at 9:44 PM, Chris
>
> This is the error message I now get:
>> *Warning*: SimpleXMLElement::__construct()
>> [simplexmlelement.--construct<
>> http://www.theredshirts.com/test/simplexmlelement.--construc t>]:
>> http%3A%2F%2Fwww.wowhead.com%2F%3Fsearch%3DAngelista%27s%2BS ash%26xml:84:
>> parser error : Entity 'nbsp' not defined in *
>> /home/thered/public_html/test/config.php* on line *28
>>
>
> Looks like the xml contains ' ' chars now - which are not valid in xml
> context it seems.
>
> Not sure if ' ' is valid but you'll have to work it out. Take the
> xml, save it to your desktop, try to show it in IE (if using windows of
> course :P). It will show errors. Once you work out how to fix it, modify
> your script accordingly.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
------=_Part_141414_1711958.1228966161546--Re: SimpleXML broke while I was sleeping.
am 11.12.2008 04:32:04 von Jack van Zanen
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
I'll pass.... we all have a senior moment every now and than :-)
Jack
2008/12/11 Nicholas Mercier
> Jack wins the right to call me an idiot for a long time. WoWhead changed
> their configuration slightly I think, that is what messed it up. I believe
> it is working now. Thank you - I was just convinced it was something dumb
> on
> my end.
>
> On Wed, Dec 10, 2008 at 9:44 PM, Chris
>
> >
> > This is the error message I now get:
> >> *Warning*: SimpleXMLElement::__construct()
> >> [simplexmlelement.--construct<
> >> http://www.theredshirts.com/test/simplexmlelement.--construc t>]:
> >> http%3A%2F%2Fwww.wowhead.com
> %2F%3Fsearch%3DAngelista%27s%2BSash%26xml:84:
> >> parser error : Entity 'nbsp' not defined in *
> >> /home/thered/public_html/test/config.php* on line *28
> >>
> >
> > Looks like the xml contains ' ' chars now - which are not valid in
> xml
> > context it seems.
> >
> > Not sure if ' ' is valid but you'll have to work it out. Take
> the
> > xml, save it to your desktop, try to show it in IE (if using windows of
> > course :P). It will show errors. Once you work out how to fix it, modify
> > your script accordingly.
> >
> > --
> > Postgresql & php tutorials
> > http://www.designmagick.com/
> >
> >
>
--
J.A. van Zanen
------=_Part_1417_7792256.1228966324645--