Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:56:07+00:00 2026-06-06T20:56:07+00:00

I am working on a small project to display live streams for Dota 2,

  • 0

I am working on a small project to display live streams for Dota 2, League of Legends and StarCraft 2 and was using a 3rd party hosted api that had both feeds from Twitch.tv and own3d – I couldn’t of been happier, until they shut down their servers!

I tried merging them together with Yahoo pipes but didn’t have much luck!
These are the two feeds I am working with:

Twitch.tv/justin.tv – http://api.justin.tv/api/stream/list.xml?category=gaming&limit=15

Own3d – http://api.own3d.tv/live?limit=15

Here is my attempt at combining the two feeds, by just listing them on top of each other. Its a temporary solution but they are not sorted by live viewers (which is something I would like to do) –

The current script I have:

<table class="table">
<thead>
<tr>
<th colspan="4" class="streamheader">Current live Sstreams</th>
</tr>
</thead>

<tbody>

<?php

$xmlFileData2 = file_get_contents("http://api.own3d.tv/live?limit=15");

$xmlData2 = new SimpleXMLElement($xmlFileData2);

foreach($xmlData2->channel->item as $item) 

if ($item->misc['game'] == 'Dota 2' OR $item->misc['game'] == 'League of Legends' OR $item->misc['game'] == 'StarCraft II') {

{

$titlelimit = $item->title;

$title = substr($titlelimit,0,20);

echo "<tr><td>";

if ($item->misc['game'] == 'League of Legends')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/lol.jpg' /></td><td>";
elseif ($item->misc['game'] == 'StarCraft II')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/sc2.jpg' /></td><td>";
elseif ($item->misc['game'] == 'Dota 2')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/dota2.jpg' /></td><td>";

else
echo "none";

echo "<a href='";
$link = $item->link;             
$findthis ="/www.own3d.tv/live/"; 
$replacement ="ae/stream/"; 
echo str_replace ($findthis, $replacement, $link);
echo "'>";
echo $title;
echo "</a></td><td>";
$author = $item->author;             
$find ="/rss@own3d.tv/"; 
$replace =""; 
echo preg_replace ($find, $replace, $author);
echo "<td>";
echo $item->misc['viewers']; 
echo "</td> </tr>";

}
}
else
{
echo "";
}

$xmlFileData1 = file_get_contents("http://api.justin.tv/api/stream/list.xml?category=gaming&limit=15");

$xmlData1 = new SimpleXMLElement($xmlFileData1);

foreach($xmlData1->stream as $itemtwitch) {

$game = $itemtwitch->meta_game;

$sc2 = "StarCraft II: Wings of Liberty";

if ($itemtwitch->meta_game == 'Dota 2' OR $itemtwitch->meta_game == 'League of Legends' OR $itemtwitch->meta_game == 'StarCraft II: Wings of Liberty') {
{
echo "<tr><td>";

$titlelimittwitch = $itemtwitch->title;

$titlelimittwitch = substr($titlelimittwitch,0,20);

if ($itemtwitch->meta_game == 'League of Legends')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/lol.jpg' /></td><td>";
elseif ($itemtwitch->meta_game == 'StarCraft II: Wings of Liberty')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/sc2.jpg' /></td><td>";
elseif ($itemtwitch->meta_game == 'Dota 2')
echo"<img src='http://localhost/ae/wp-content/themes/ae/img/dota2.jpg' /></td><td>";
else
echo "none";

$data = $itemtwitch->name;
$find ="/live_user_/";
$replace ="";
echo "<a href='";
echo "http://localhost/ae/stream/";
echo preg_replace ($find, $replace, $data);
echo "''>";
echo "$titlelimittwitch";
//print(" - " . $itemtwitch->meta_game . "");
echo "</a></td><td>";
echo preg_replace ($find, $replace, $data);
print("</td><td>" . $itemtwitch->channel_count . "</td></tr>");
}
}
else {
echo "";
}
}
?>

<tr>

<th colspan="4" class="streamheader centered">View all streams</th>
</tr>   
</tbody>
</table>

Any guidance or being pointed in the right direction would be fantastic.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:56:10+00:00Added an answer on June 6, 2026 at 8:56 pm

    Dan, you will need to add both sets of information(own3d/twitch) to the same array, then sort it. Say you add them to an array named $streamArray you would use the following code to then sort them by viewers.

    foreach ($streamArray as $key => $row) {
     $viewers[$key] = $row['viewers'];
    }
    
    array_multisort($viewers, SORT_DESC, SORT_NUMERIC, $streamArray);
    

    I have developed a similar setup at http://halfw.com/streams.php

    If you have any questions just let me know!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a small project, where I'm using the codeigniter php framework, but
I am working on a small project in google app engine. Using html5 canvas
I am working on a small C# / ASP.NET project that will display 4
I am working on a small project for learning PHP better. This project has
I'm working on a small project that involves me loading an image into a
i am working on a small project that i need the ability to let
I'm currently working on a small project to learn Linq where I want to
I am fairly new to ASP.NET MVC and working on a small project in
I'm new to objective C and currently working on a small project. I have
I'm working on a small uni project where I have a program for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.