php - I'm getting empty object attribute when i use simplexml_load_string -
when i'm trying use simplexml_load_string
returns array of "simple xml objects" "empty" object attributes. attributes not empty in real xml output!
do have suggestions?
$url = "widgets.sportsevents365.com/data/tickets/v2.0/events/?q=cq,0,$sporttype,$numofdays&page=$page&perpage=$perpage"; $ch = curl_init(); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_httpheader ,array('contect-type:text/xml','application/xml') ); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_userpwd, "*****:*****"); $result = curl_exec($ch); curl_close($ch); $xmldata = simplexml_load_string($result); print_r( $xmldata );
from comment...
im getting values inside
<![cdata[
, simplexml_load_string removig them, how catch values ?
you need use libxml_nocdata
flag.
$xmldata = simplexml_load_string($result,libxml_nocdata);
why use libxml_nocdata
?
by using flag merge cdata
text nodes.
Comments
Post a Comment