Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

Another way for API processing with PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GelioS
    replied
    Added methods to delete match(es). See match_mapper_db and matches_mapper_db.
    Added JSON for regions.
    Added halloween and greevil items to items.json.

    See ReadMe for more info.

    Leave a comment:


  • jaffarbp
    replied
    Just wanted to say that you have done an awesome job! To anyone using the api just a quick tip that i somehow missed -> since you have been limited to getting up to 25 matches per request when requesting the next 25 get the oldest match id from database and search from it. Example would be ($oldest = oldest id)
    $matches_mapper_web->set_start_at_match_id($oldest);

    Leave a comment:


  • Tharuler
    replied
    Nice design! Glad to see dotareport.net isn't the only one who is inspired by us

    Leave a comment:


  • GelioS
    replied
    Update:
    • JSON data about heroes, abilities, items, lobbies, mods and new processing for it
    • New method for picks and bans - get divided by team and state
    • New method for match model - get set of the slots divided to Dire and Radiant
    • XML error handling support for mappers


    Match view demo (put your match_id in the url)

    Leave a comment:


  • GelioS
    replied
    Additional units support added (testing now) - click.

    Leave a comment:


  • GelioS
    replied
    Not big example of usage - Get all leagues matches and calculate win rate for each hero

    Leave a comment:


  • SAK_ATAK
    replied
    Just wanted to say this looks really cool and I will probably look into it sometime. I myself have done a few API libraries and I know how much of a pain they can be to make (at least in java and C# they are). kudos!

    Leave a comment:


  • GelioS
    replied
    Huge update - more examples, comments, code review etc.

    List of supported API-requests:
    • GetMatchHistory
    • GetMatchDetails
    • GetPlayerSummaries
    • GetLeagueListing
    • GetLiveLeagueGames
    • GetTeamInfoByTeamID
    • GetHeroes

    https://github.com/kronusme/dota2-api

    First post is updated.
    Last edited by GelioS; 02-21-2013, 02:36 PM.

    Leave a comment:


  • GelioS
    replied
    More API features supported.
    Look at readme examples on the GitHub - https://github.com/kronusme/dota2-api.

    Leave a comment:


  • GelioS
    replied
    Added teams and players parsers.

    Teams:
    PHP Code:
    <?php
    require_once ('config.php');
    $teams_mapper_web = new teams_mapper_web();
    $teams $teams_mapper_web->set_team_id(2)->set_teams_requested(2)->load();
    print_r($teams);
    Players:
    PHP Code:
    <?php
    require_once ('config.php');
    $players_mapper_web = new players_mapper_web();
    $info $players_mapper_web->add_id('76561198067833250')->add_id('76561198058587506')->load();
    print_r($info);

    Leave a comment:


  • GelioS
    started a topic Another way for API processing with PHP

    Another way for API processing with PHP

    First of all I want say great thanks to Valve for this API.

    For the last few weeks (and a little bit on September 2012) I have been working on a simple API wrapper. And I think that I am on the right way

    List of supported API-requests:
    • GetMatchHistory
    • GetMatchDetails
    • GetPlayerSummaries
    • GetLeagueListing
    • GetLiveLeagueGames
    • GetTeamInfoByTeamID
    • GetHeroes


    Match view demo (put your match_id in the url)

    All code can be found on github https://github.com/kronusme/dota2-api.

    And few examples:

    Load some match-info
    PHP Code:
    <?php
    require_once ('config.php');
    $mm = new match_mapper_web(121995119);
    $match $mm->load();
    Work with match-object
    PHP Code:
    <?php
    require_once ('config.php');
    $mm = new match_mapper_web(121995119);
    $match $mm->load();
    echo 
    $match->get('match_id');
    echo 
    $match->get('start_time');
    echo 
    $match->get('game_mode');
    $slots $match->get_all_slots();
    foreach(
    $slots as $slot) {
        echo 
    $slot->get('last_hits');
    }
    print_r($match->get_data_array());
    print_r($match->get_slot(0)->get_data_array());
    Save match-info in the database
    PHP Code:
    <?php
    require_once ('config.php');
    $mm = new match_mapper_web(121995119);
    $match $mm->load();
    $saver = new match_mapper_db();
    $saver->save($match);
    I want get all matches with some player
    PHP Code:
    <?php
    require_once ('config.php');
    $matches_mapper_web = new matches_mapper_web();
    $matches_mapper_web->set_account_id(93712171);
    $matches_short_info $matches_mapper_web->load();
    foreach (
    $matches_short_info AS $key=>$match_short_info) {
        
    $match_mapper = new match_mapper_web($key);
        
    $match $match_mapper->load();
        
    $mm = new match_mapper_db();
        
    $mm->save($match);
    }
    Get player info
    PHP Code:
    <?php
    require_once ('config.php');
    $players_mapper_web = new players_mapper_web();
    $players_info $players_mapper_web->add_id('76561198067833250')->add_id('76561198058587506')->load();
    foreach(
    $players_info as $player_info) {
        echo 
    $player_info->get('realname');
        echo 
    '<img src="'.$player_info->get('avatarfull').'" alt="'.$player_info->get('personaname').'" />';
        echo 
    '<a href="'.$player_info->get('profileurl').'">'.$player_info->get('personaname').'\'s steam profile</a>';
    }
    print_r($players_info);
    Get team info
    PHP Code:
    <?php
    $teams_mapper_web 
    = new teams_mapper_web();
    $teams $teams_mapper_web->set_team_id(2)->set_teams_requested(2)->load();
    foreach(
    $teams as $team) {
        echo 
    $team->get('name');
        echo 
    $team->get('rating');
        echo 
    $team->get('country_code');
        
    print_r($team->get_all_leagues_ids());
    }
    Get current heroes list
    PHP Code:
    <?php
    require_once ('config.php');
    $heroes_mapper = new heroes_mapper();
    $heroes $heroes_mapper->load();
    print_r($heroes);
    Get leagues list
    PHP Code:
    <?php
    require_once ('config.php');
    $leagues_mapper = new leagues_mapper();
    $leagues $leagues_mapper->load();
    foreach(
    $leagues as $league) {
        echo 
    $league['description'];
        if (
    $league['tournament_url']) {
            echo 
    $league['tournament_url'];
        }
     }
    Get live leagues matches
    PHP Code:
    <?php
    require_once ('config.php');
    $league_mapper = new league_mapper(22); // set league id (can be get via leagues_mapper)
    $games $league_mapper->load();
    print_r($games);
    Last edited by GelioS; 03-10-2013, 11:35 AM. Reason: New examples added
Working...
X