sintonia/airtime_mvc/application/common/TuneIn.php
drigato cf24c141fd SAAS-772: Send metadata to Tunein
This is pretty much working for scheduled metadata - just to need to
test with a TuneIn account.
2015-05-13 16:05:37 -04:00

29 lines
948 B
PHP

<?php
class Application_Common_TuneIn
{
public static function sendMetadataToTunein($title, $artist)
{
$tuneInStationID = null;
$tuneInPartnerKey = null;
$tuneInPartnerID = null;
$qry_str = "?partnerId=".$tuneInPartnerID."&partnerKey=".$tuneInPartnerKey."&id=".$tuneInStationID
."&title=".$title."&artist=".$artist;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, TUNEIN_API_URL . $qry_str);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$jsonData = curl_exec($ch);
if (curl_error($ch)) {
Logging::error("Failed to reach TuneIn: ". curl_errno($ch)." - ". curl_error($ch) . " - " . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL));
}
curl_close($ch);
$arr = json_decode($jsonData, true);
Logging::info($arr);
}
}