XML : PHP: XPath query returns nothing from large XML

  $newstring = substr_replace("http://ws.spotify.com/search/1/track?q=", $_COOKIE["word"], 39, 0);  /*$curl = curl_init($newstring);  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);  $result = curl_exec($curl);*/  //echo $result;      $xml = simplexml_load_file($newstring);  //print_r($xml);  $xpath = new DOMXPath($xml);    $value = $xpath->query("//track/@href");    foreach ($value as $e) {    echo $e->nodevalue;  }    

This is my code. I am using spotify to supply me with an xml document. I am then trying to get the href link from all of the track tags so I can use it. Right now the print_r($xml) I have commented out works, but if I try to query and print that out it returns nothing. The exact link I am trying to get my xml from is: http://ws.spotify.com/search/1/track?q=incredible

No comments:

Post a Comment