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

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
simplexml_load_file failed to open stream Http request failed

Categories

HOME
vim
ionic-framework
vbscript
netsuite
proxy
magnific-popup
isabelle
tesseract
alfresco
xmpp
at-command
maven-3
amortized-analysis
infragistics
packages
sql-server-2016
cross-validation
facebook-messenger-bot
maude-system
facebook-php-sdk
row
etl
google-cloud-spanner
spring-tool-suite
static-libraries
messages
hapi
netflix
serilog
reactcsstransitiongroup
visual-composer
dbext
opencover
web-sql
pass-by-reference
captiveportal
user-interaction
framemaker
hybridauth
phpfreechat
windows-dev-center
hockeyapp
libraries
code-search-engine
unobtrusive-validation
core-plot
flickr-api
pango
errordocument
drupal-6
knockout-components
typed-lambda-calculus
arrow-keys
redundancy
crosswalk-runtime
objective-c-swift-bridge
jquery-filter
database-optimization
login-control
thrust
mathematica-frontend
storekit
lttng
nsviewcontroller
prettytensor
qgraphicsview
rvest
suffix-tree
revolution-r
icu4j
collapse
retina
wireshark-dissector
fouc
iis-arr
browser-bugs
deis
p2
jsapi
npapi
cdt
android-imagebutton
applescript-objc
device-manager
bitcoinj
has-many-through
dml
didselectrowatindexpath
gridfs
dexterity
quartz-graphics
orchardcms-1.7
sabredav
android-hardware
dmoz
path-separator
nsmanagedobject
pendrive
bigcouch
work-stealing
subscript
gcj
javax.script
imac
jquery-ui-droppable
genealogy
commodore
rtml

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App