Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. // http://api.radionomy.com/currentsong.cfm?radiouid=xxx&apikey=xxx&callmeback=yes&type=xml&cover=yes&previous=yes
  3. $uuid = "xxx";
  4. $apikey = "xxx";
  5. $url = "http://api.radionomy.com/currentsong.cfm?radiouid=".$uuid."&apikey=".$apikey."&callmeback=yes&type=xml&cover=yes&previous=yes";
  6. // print($url);
  7. // create curl resource
  8. $ch = curl_init();
  9. // set url
  10. curl_setopt($ch, CURLOPT_URL, $url);
  11. //return the transfer as a string
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13. // $output contains the output string
  14. $output = curl_exec($ch);
  15. // close curl resource to free up system resources
  16. curl_close($ch);
  17.  
  18. $xml = simplexml_load_string($output);
  19. $json = json_encode($xml);
  20. $array = json_decode($json,TRUE);
  21.  
  22. print('titel: '. $array['track']['title']);
  23. print("<br>");
  24. print('artiest: ' . $array['track']['artists']);
  25.  
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement