VB icon

Tune In - API PHP CODE

Email
Submitted on: 10/1/2016 9:14:23 AM
By: kegham  
Level: Advanced
User Rating: Unrated
Compatibility: PHP 5.0
Views: 2234
author picture
 
     Retrieve meta information from ICECAST audio server output arrays and submit custom required data to TUNE IN. Example ( Artist Name - Song Information ). Here is the short and useful TUNE IN API code, for those who have problem with their TUNE IN radio station, about the ARTIST & TITLE not showing. This is a real nightmare for many people as it was also for me, but i hardly work on, and finally i was able to succeed. So hopefully might help for many of you. The complete code link below :)
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Tune In - API PHP CODE
// Description:Retrieve meta information from ICECAST audio server output arrays and submit custom required data to TUNE IN. Example ( Artist Name - Song Information ). Here is the short and useful TUNE IN API code, for those who have problem with their TUNE IN radio station, about the ARTIST & TITLE not showing. This is a real nightmare for many people as it was also for me, but i hardly work on, and finally i was able to succeed. So hopefully might help for many of you. The complete code link below :)
// By: kegham
//**************************************

<?php
// TuneIn Air API PHP Script for IceCast - AutoDJ support
// CODE HAS BEEN WRITTEN BY KEGHAM DEPOYAN
// http://www.radioarev.com | info@radioarev.com
// Add this script to cron job run every ( Min 15 seconds - Max 1 Min )
// https://cron-job.org \\
// -----------------------------------------------------------------------------------------------\\
// TuneIn API settings
$PartnerID = 'xxxxxxxx'; // TuneIn partner ID
$PartnerKey = 'xxxxxxxxxxxx'; // TuneIn partner key
$StationID = 'sxxxxxx'; // TuneIn station ID
// Get file content from streaming server and decode output
$url = 'http://yourstreamingserver.com/rpc/username/streaminfo.get';
$filestring = file_get_contents($url);
$decode = json_decode($filestring, True);
// Read output arrays and separate them by Artist & Title
$read_artist = $decode['data']['0']['track']['artist'];
$read_title = $decode['data']['0']['track']['title'];
// Urlencode them to send over http://air.radiotime.com ( Tune In )
$artist = urlencode($read_artist);
$title =urlencode($read_title);
// Finally Send over the required information with all variables
$tunein = "http://air.radiotime.com/Playing.ashx?partnerId={$PartnerID}&partnerKey={$PartnerKey}&id={$StationID}&title={$title}&artist={$artist}";
file_get_contents($tunein);
?>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.