Created
January 11, 2012 03:26
-
-
Save masbog/1592827 to your computer and use it in GitHub Desktop.
Radio list using PHP (json)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-type: application/json'); | |
if($_GET['list'] == 'jogjastreamers') | |
{ | |
$url = 'http://www.jogjastreamers.com/m/radiolist_ipad.php'; | |
//open connection | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_ENCODING, 1); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/json; charset=utf-8')); | |
curl_setopt($ch, CURLOPT_USERAGENT, "jogjastreamers/1.081811"); | |
//execute post | |
$result = curl_exec($ch); | |
$sxml = simplexml_load_string($result); | |
echo json_encode($sxml); | |
//close connection | |
curl_close($ch); | |
} | |
if($_GET['list'] == 'jakfm') | |
{ | |
$url = 'http://apps.radioactive.sg/mahaka/getConfig.php?app=jak&deviceId=masbog9d8528e45a06ab56ba0eb72686ac380613&deviceType=iphone&zip=1&appVersion=2'; | |
//open connection | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_ENCODING, 1); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('application/json; charset=utf-8')); | |
curl_setopt($ch, CURLOPT_USERAGENT, "jakfm/2.0.0"); | |
//execute post | |
$result = curl_exec($ch); | |
echo $result; | |
//close connection | |
curl_close($ch); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment