simplexml


Having trouble getting Fogbugz API response into a SimpleXML object


I'm trying to write a wrapper around the fogbugz API, starting with getting a login token. I don's seem to be able to get the token into my wrapper object.
$url = "http://..../fogbugz/api.asp?cmd=logon&email=" . $_UN . "&password=" . $_PW;
$contents = file_get_contents($url);
$resp = simplexml_load_file($contents);
print_r($resp);
Response is: SimpleXMLElement Object ( [token] => SimpleXMLElement Object ( ) ) The object in the token member var is empty. The response string however is OK. If I use
header("Content-type: text/xml");
echo $contents;
I get the correct XML back from the API. Furthermore, if I use the xml as a string, directly in the code it works fine:
$xml = "<?xml version='1.0'?><response><token>iibgo9d785iavs5av5a6lrimbn2r54</token></response>";
$resp = simplexml_load_string($xml);
print_r ($resp);
Response: SimpleXMLElement Object ( [token] => iibgo9d785iavs5av5a6lrimbn2r54 ) Can anyone please tell me how to get the response token into the SimpleXML Object?
I think the XML returned from the API might look like this actually:
<?xml version='1.0'?><response><token><![CDATA[iibgo9d785iavs5av5a6lrimbn2r54]]><token><response>
SimpleXML can't parse CDATA objects.

Related Links

Get children attributes using simplexml
Select attribute in simplexml
Save formatted xml
SimpleXML (Zend_Config_Xml actually) and foreach : which tag am I iterating?
simplexml_load_file() error happening in only localhost/xampp
SimpleXml tar.gz
simplexml_load_file error in PHP 5.3
simplexml_load_file not a valid URI issue
Can't turn XML response into an simplexml object
Having trouble getting Fogbugz API response into a SimpleXML object
Upgraded to php 5.3.10 and simpleXMLelement is broken
Parsing RSS Feed with SimpleXML
php simplexml_load_file (script url) failed to open stream
PHP - SimpleXML not returning object
Having trouble processing XML with PHP SimpleXML
Simplexml How to access all element of the same node

Categories

HOME
twitter
vbscript
pypi
gerrit
minimum-spanning-tree
azure-data-factory
nullpointerexception
view
read-eval-print-loop
baqend
blueprintjs
echarts
wamp
metatrader4
tomcat6
fancybox-3
modelica
alignment
lombok
openrefine
tostring
database-replication
interop
web-sql
accessor
captiveportal
django-storage
intel-pin
jaxb2
javascriptcore
http-referer
amazon-kinesis-kpl
mmenu
fusionpbx
http-digest
swisscomdev
multilingual
vao
babel-core
menuitem
errordocument
multipeer-connectivity
celery-task
brightcove
drupal-6
forever
epson
chord-diagram
url-masking
file-writing
skobbler-maps
gstreamer-0.10
qcustomplot
python-stackless
hexdump
livequery
php-internals
historian
coveralls
browser-bugs
ideamart
fluid-dynamics
census
apache-commons-net
kineticjs
dd
jscript.net
android-imagebutton
asp.net-web-api-odata
gulp-less
googlemock
bitcoinj
typeof
page-layout
geos
quantlib-swig
dataadapter
xamlparseexception
http-unit
ocunit
pvrtc
jquery-knob
funscript
runas
venn-diagram
pysimplesoap
ocx
amazon-appstore
semantic-diff
psi
f#-powerpack
appender
disclosure
ncqrs
mediarss
scripting-languages

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App