Pues eso he estado cambiando el modulo de stream, para poder ponerlo en mi web, para que me detecte, los stream online me los muestre.
Pero tengo un problema, y es que la url que quiero cambiarla para que no mande a la web de twitch.tv. Si no que me mande a un articulo que yo cree, que dependiendo de la variable, o lo que sea, me muestre un articulo con el stream de ese jugador y lo que yo ponga, no se si me explico.
El codigo que estoy cambiando es este:
Código:
<?php
echo '<b>StarCraft: Brood War</b> </br>';
defined('_JEXEC') or die('Direct access to this location is not allowed.');
//get's the comma seperated list from the module manager page
$userList = $params->get('userlist');
// This variable becomes one long url with the channel names stringed up behind it
// This url then fetches a json file from twitch with all the selected channels information
$usersArray = explode(',', $userList);
//grabs the channel data from twitch.tv streams
$userGrab = "http://api.justin.tv/api/stream/list.json?channel=";
$checkedOnline = array ();
//creates a url for retrieving the twitch json file for our selected users
foreach($usersArray as $i =>$value){
$userGrab .= ",";
$userGrab .= $value;
}
unset($value);
//grabs the channel data from our teams twitch.tv streams using the $userGrab url
$json_file = file_get_contents($userGrab, 0, null, null);
//decodes the jason file and turns it into an array
$json_array = json_decode($json_file, true);
//get's member names from stream url's and checks for online usersArray
foreach($usersArray as $i =>$value){
$title = $json_array[$i]['channel']['channel_url'];
$array = explode('/', $title);
$member = end($array);
$viewer = $json_array[$i]['stream_count'];
$topic = $json_array[$i]['title'];
onlinecheck($member, $viewer, $topic);
$checkedOnline[] = signin($member);
}
unset($value);
unset($i);
//checks if player streams are online
function onlinecheck($online, $viewers, $topic)
{
//If the variable online is not equal to null, there is a good change this person is currently streaming
if ($online != null)
{
echo '<a href="http://www.twitch.tv/'.$online.'"> <strong>'.$online.'</strong></a>';
echo ' </br>';
//echo '<strong>'.$topic.'</strong> </br>';
}
}
//This funcion add's online channel names to the checked online array
function signin($person){
if($person != null){
return $person;
}
else{
return null;
}
}
?>
La variable $userList lo recoje en otro codigo y la pasa por aki, y es el nombre del jugador
Pd: mi web es:
http://starbound-esp.com/