Jump to content

mdexter

Members
  • Posts

    6
  • Joined

  • Last visited

mdexter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks mate, sorry I think I will pay someone to quickly do this, I am not a coder and I don't have the time to go that deep into it, I managed on my own to do a tooltip from the values set in the script its on my site: www.aoe2hdozclan.com Cheers anyway mate, appreciate your time
  2. ok,Ill have a look at what you posted, thanks for setting me on the right direction, coding 101 thanks
  3. Do I add to the current code, I can see different coding for javascript etc, but not sure how to add it etc?
  4. Ok, so I am googling javascript onmouse over then? Sorry not sure which way to go, obviously we need to keep the code as is b ut do I google javascript onmouseover?
  5. Hey all, ok I have this script below which shows our twitch.tv users who are online and offline, its a great script but we would like the function as users have asked to be able to have a popup when you hover over each users channel link. Now the popup has been suggested that it needs to be an image or snapshot of the online users twitch page. so an online user you will highlight the link and it will show a popup image of the URL page that the link links to, their twitch.tv account. And example of the function we are after is here: www.aoczone.net (top right hand corner streamers) GUYS IS THIS POSSIBLE TO ADD THAT FUNCTION TO THE BELOW CODE, sorry guys I am not a coder more of a graphics person, could someone help us out please on this one? Code for the whole script is below: __________________________________________________________________ <html> <head> <style> font-family:Verdana, Arial, Helvetica; font-size: 70%; color: #825a15; font-weight:bold; </style> <title>Streamlist</title> </head> <body> <FONT color=#825a15 face="tahoma" size="2pt"> <?php /** * @version 0.1 * @copyright © 2012/2013 Cees Middel (Avon) www.maegis.net * @Inspired by Syi http://mushroom-mayhem.com * @license GNU/GPL v3 http://www.gnu.org/licenses/gpl.html */ /** * array with all stream names i.e. www.twitch.tv/"iksf". * To add more users just add their channel names with comma seperation * This is all there is, no futher editing required */ $members = array("aoe2hdozclan","manbeast_aoe","brannin","pain1800","usk_apocalipce","resonance22"); // 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 $userGrab = "http://api.justin.tv/api/stream/list.json?channel="; //I use this array to compare with the members array. All users in this arrat are substracted from the members array and hence are //"offline" $checkedOnline = array (); foreach($members as $i =>$value){ $userGrab .= ","; $userGrab .= $value; } unset($value); //grabs the channel data from twitch.tv streams $json_file = file_get_contents($userGrab, 0, null, null); $json_array = json_decode($json_file, true); //get's member names from stream url's and checks for online members foreach($members as $i =>$value){ $title = $json_array[$i]['channel']['channel_url']; $array = explode('/', $title); $member = end($array); $viewer = $json_array[$i] ['stream_count']; onlinecheck($member, $viewer); $checkedOnline[] = signin($member); } unset($value); unset($i); //checks if player streams are online function onlinecheck($online, $viewers) { //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.'" target="_blank"> <strong>'.$online.'</strong></a>'; echo '&nbsp <img src="/images/online.png"><strong></strong> Online</br>'; echo '<img src="/images/viewers.png"><strong>Viewers:</strong> &nbsp' .$viewers.'</br>'; } } //This funcion add's online channel names to the checked online array function signin($person){ if($person != null){ return $person; } else{ return null; } } ?> </font> <hr> <FONT color=#825a15 face="tahoma" size="2pt"> <?php //This part list all the people currently offline. Here the array with online users is compared with the total users. //online users are then removed from the total users array. foreach ($members as $i => $value1) { foreach($checkedOnline as $ii => $value2){ if($value1 == $value2){ unset($members[$i]); } } } //print a nice list with people that can't currently be bothered with streaming their games foreach ($members as $i => $value) { echo '<a href="http://www.twitch.tv/'.$value.'" target="_blank"> <strong>'.$value.'</strong></a>'; echo '&nbsp<img src="/images/offline.png"> <strong></strong> Offline</br>'; } ?> </font> </body> </html> ____________________________________________________________________
  6. Hello all, This is my very first post here and I hope someone could help me out on this as it has been a labour intensive time to try and learn all about this coding. I am trying to learn this coding using PHP and trying to do stuff myself and just through a lot of research.......I have found the holy grail of all XML feeds and this was the one feed that people who look to the main steam rankings for. Ok so I am very excited to share this with you guys and show you what I have done based on how you have educated me so far, please bear with me here: Ok the XML feed (the holy grail) is the GLOBAL USER RANKINGS, there is only one site using it now: www.aoe2stats.com They are doing what I a trying to achieve and I think I am 95% there based on what you guys have taught me through the coding, ok so here it is, I hope I still have peoples attention here. here is the link to the XML FEED: http://steamcommunity.com/stats/AgeofEmpiresIIHDEdition/leaderboards/131879/?xml=1 Ok, this information I am trying to extract is the following: http://steamcommunity.com/stats/Ageo...l=1&start=5001 ]]> </nextRequestURL> <resultCount>5000</resultCount> <entries> <entry> <steamid>76561198032048763</steamid> <score>689</score> <rank>1</rank> <ugcid>-1</ugcid> <details> <![CDATA[ ]]> </details> </entry> <entry> <steamid>76561198011427258</steamid> <score>632</score> <rank>2</rank> <ugcid>-1</ugcid> <details> <![CDATA[ ]]> ___________________________________________________ Into a table with 4 columns, with the names on each column: Steam Name - Score - Rank - Ugcid Now this is where I am learning also, I need to parse the (steamid) into the (community id) the steam id is the long number above and the community id is username on steam: website to show example: steamidfinder.com ok I have found a script to parse the <steamid>76561198032048763</steamid> into the person name: Huehnerbein as an example above, so I have been doing a lot of reaearching and I have found the following: _____________________________________________________________ Assuming that your input steam_id is $INPUT and your final output array is stored in $OUTPUT, this is the functional for each approach that you could use to convert steam_id to personaname: /** * Convert steam_id to personaname * @returns STRING The name associated with the given steam_id * BOOL FALSE if no match was found */ function steamID_to_name($INPUT, $OUTPUT) { // This gets the relevant part of the API response. $array = $OUTPUT['response']['players']; // Using your function to convert `steam_id` to a community ID $community_id = SteamID2CommunityID($INPUT); // Linear search foreach ($array as $array_item) { // If a match was found... if ($community_id == $array_item['steamid']) // Return the name return $array_item['personaname']; } // If no match was found, return FALSE. return false; } _________________________________________________________________ So the conclusion is the script below, unfortunately is does not work but I have tried to change the neccesary parameters in the script, so the objective is: as what www.aoe2stats.com are the only ones who have done it!! To have the 4 entries in a 4 column table: Steam Name - Score - Rank - Ugcid and to have the steamid parse into the community_id or username. OK THE ACTUAL SCRIPT I HAVE MODIFIED, IT DOES NOT WORK BUT CAN YOU GUYS SHARE WITH ME WHAT MISTAKES I HAVE MADE SO I CAN GET THIS HOLY GRAIL SCRIPT WORKING, I HAVE SPENT HOURS ON THIS: SCRIPT BELOW: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <?php header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); $sFeed = 'http://steamcommunity.com/stats/AgeofEmpiresIIHDEdition/leaderboards/131879/?xml=1' . microtime(true); /** * Convert steam_id to personaname * @returns STRING The name associated with the given steam_id * BOOL FALSE if no match was found */ function steamID_to_name($INPUT, $OUTPUT) { // This gets the relevant part of the API response. $array = $OUTPUT['response']['players']; // Using your function to convert `steam_id` to a community ID $community_id = SteamID2CommunityID($INPUT); // Linear search foreach ($array as $array_item) { // If a match was found... if ($community_id == $array_item['steamid']) // Return the name return $array_item['personaname']; } // If no match was found, return FALSE. return false; } $dom = new DOMDocument('1.0', 'utf-8'); $dom->load($sFeed); $steamid = $dom->getElementsByTagName('steamid'); if ($entry->length > 0) $score = $dom->getElementsByTagName('score'); if ($entry->length > 0) $rank = $dom->getElementsByTagName('rank'); if ($entry->length > 0) $ugcid = $dom->getElementsByTagName('ugcid'); if ($entry->length > 0) { ?> <style> table, td, th body { font-family:Verdana, Arial, Helvetica; font-size: 81%; margin: 0px; color: #5c3d0b; font-weight:bold; } { border:1px solid black; } th { background-color:e6cb9c; } </style> <table border="1"> <tr> <th>NAME</th> <th>SCORE</th> <th>RANK</th> <th>UGCID</th> </tr> <? foreach ($entry AS $entry) { $steamid = $entry->getElementsByTagName('steamid')->item(0)->nodeValue; $score = $entry->getElementsByTagName('score')->item(0)->nodeValue; $rank = $entry->getElementsByTagName('rank')->item(0)->nodeValue; $ugcid = $entry->getElementsByTagName('ugcid')->item(0)->nodeValue; printf("<tr><td>%s</td><td>%s</td></tr>" . PHP_EOL, $name, $percent); } print('</table>'); } ___________________________________________________________________ OK PLEASE PLEASE GUYS WOULD LOVE TO SEE WHAT I HAVE DONE WRONG TO GET THIS SCRIPT WORKING SO MANY THANKS!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.