0

I asked this question before but I got no answers. I'll try to narrow down the question. See this post What's wrong with this code:

$url = "http://.../fogbugz/api.asp?cmd=logon&email=" . $_UN . "&password=" . $_PW;
$resp = new SimpleXMLElement(file_get_contents($url));

Yields:

SimpleXMLElement Object ( [token] => SimpleXMLElement Object ( ) ) 

If I output the response of file_get_contents directly to the screen using a header I see the response is correct and the token element is filled with a valid token. Yet simplexml doesn't seem to be able to read the token.

Community
  • 1
  • 1
micksp
  • 123
  • 2
  • 15

1 Answers1

0

I don't think SimpleXML is able to parse CDATA sections and since most of what the FogBugz XML API returns is UTF-8 data, it is put into XML CDATA blocks. Your browser might be hiding that from you, but if you look at the raw info return from cmd=logon, I believe it is a CDATA.

Michael Pryor
  • 25,046
  • 18
  • 72
  • 90