Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 22nd, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. function curl_post($url, $data)
  4. {
  5.         $ch = curl_init();
  6.        
  7.         curl_setopt($ch, CURLOPT_URL, $url);
  8.         curl_setopt($ch, CURLOPT_HEADER, 0);
  9.         curl_setopt($ch, CURLOPT_POST, 1);
  10.         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  11.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  12.        
  13.         return curl_exec($ch);
  14.        
  15.         curl_close($ch);
  16. }
  17.  
  18. $data = array('key' => '42E4E3F3A6304382A77CAC6288124358', 'query' => 'Skream', 'genre' => '1603', 'class' => 'single');
  19.  
  20. $xml = simplexml_load_string( curl_post('http://www.juno.co.uk/api/1.2/bundle/getlist', $data) );
  21. foreach($xml->bundles->bundle as $bundle)
  22. {
  23.         echo $bundle->title . '<br>';  
  24. }
  25.  
  26. ?>