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

  • #31
    League mapper, updated DB schema etc.
    https://github.com/kronusme/dota2-api

    DotA 2 Web API Processing with PHP
    DotA2 Statistic - Professional leagues statistic
    follow @dota2statistic

    Comment


    • #32
      Hi, Gelious.

      Let me start of by saying that i am proud of what you have achieved by combining steam api and valve api together to create this masterpiece.

      I am currently trying to build a league of my own inside my website through xenforo forums, for which i need your help if possible.

      Would it be possible for us to team up to do something together which is mutually beneficial for us ?

      Awaiting for your reply

      Comment


      • #33
        You should look at doing two things:
        1) don't define the autoload function yourself, it restricts the user of your API. I was just implementing your API and I had to adjust my code to allow for our autoloads to coexist.
        i.e. use the spl_autoload_register
        Code:
        function kronusme_autoload_function($class) {
          //
        }
        spl_autoload_register( 'kronusme_autoload_function' ); // add your function to be first on the stack
        spl_autoload_register( '__autoload' ); // doesn't matter if the user hasn't defined __autoload yet, will reference it when needed.
        this way the user can define an __autoload function whenever they want and it won't cause an error because you've already defined it (or vice versa).

        2) you should look into using php namespaces so you don't pollute the global namespace.
        that way the user can define classes of the same name without worrying about it colliding
        this also lends itself to using the autoload register because you don't have to worry about accidentally loading their class in stead of yours.

        also you can streamline your class loading.


        to make it even easier, rename your class files to XXXX.class.php in stead of class.XXXX.php as you'll see below:
        your autoload function then simplifies to:

        Code:
        function kronusme_autoload_function($class) {
            	$path = config::get('base_path') . DIRECTORY_SEPARATOR . $class . '.class.php';
            	if( file_exists($path) ) {
            	    	require_once($path);
            	}
        }
        Last edited by MuppetMaster42; 10-13-2013, 02:27 AM.
        The API Bible: Things You Should Know Before Starting API Development

        Comment


        • #34
          found a bug:
          class.match_mapper_db.php:136
          field name for inserting into the users table is 'steamid'
          does not match the latest field list in your db_latest.sql
          Last edited by MuppetMaster42; 10-13-2013, 03:26 AM.
          The API Bible: Things You Should Know Before Starting API Development

          Comment


          • #35
            useful to improve my php ability.thank u very much!
            btw,what 'slot_id' mean in database ? How to construct it?
            Last edited by ilyf422; 10-14-2013, 07:19 AM.

            Comment


            • #36
              MuppetMaster42, thanks for the response! I'll take a look about autoload (db_latest.sql is already fixed).
              ilyf422, slot_id (in the ability_upgrades and additional_units) is just a foreign key to the slots table. It is generated by the MySQL.
              PL-Pooya, sorry for the late reply, but it isn't possible.

              DotA 2 Web API Processing with PHP
              DotA2 Statistic - Professional leagues statistic
              follow @dota2statistic

              Comment


              • #37
                Ember and Earth Spirits are added.

                DotA 2 Web API Processing with PHP
                DotA2 Statistic - Professional leagues statistic
                follow @dota2statistic

                Comment


                • #38
                  Dota2 API Wrapper

                  Fixed Visage and Naix abilities lists.
                  Regions list updated (taken from here).
                  Renamed Necrolite and Windrunner.
                  Added team_id parameter for matches_mapper_db (see here).
                  Last edited by GelioS; 12-10-2013, 11:52 PM.

                  DotA 2 Web API Processing with PHP
                  DotA2 Statistic - Professional leagues statistic
                  follow @dota2statistic

                  Comment


                  • #39
                    Did you already have a regions list? I would have gladly saved myself the effort.

                    Comment


                    • #40
                      Yes, I took it from your thread.

                      DotA 2 Web API Processing with PHP
                      DotA2 Statistic - Professional leagues statistic
                      follow @dota2statistic

                      Comment


                      • #41
                        Originally posted by GelioS View Post
                        Yes, I took it from your thread.
                        Please keep an eye out for other clusters. I doubt I got them all as that was only from a few hour stretch of data.

                        Comment


                        • #42
                          Phoenix and Terrorblade are already in jsons (with their abilities) - click.

                          DotA 2 Web API Processing with PHP
                          DotA2 Statistic - Professional leagues statistic
                          follow @dota2statistic

                          Comment


                          • #43
                            I've uploaded the files from github to my server (root), added API and db details in config.php, and now trying to run the SQL query. However I get the following error:
                            #1005 - Can't create table 'dota2wp.ability_upgrades' (errno: 150) How come?
                            Last edited by Frode; 02-10-2014, 04:10 AM.

                            Comment


                            • #44
                              Originally posted by Frode View Post
                              I've uploaded the files from github to my server (root), added API and db details in config.php, and now trying to run the SQL query. However I get the following error:
                              #1005 - Can't create table 'dota2wp.ability_upgrades' (errno: 150) How come?
                              Anybody?

                              Comment


                              • #45
                                Frode, I tried to run db_latest.sql few minutes ago and didn't get any error.
                                Did you modify sql-queries from file?

                                DotA 2 Web API Processing with PHP
                                DotA2 Statistic - Professional leagues statistic
                                follow @dota2statistic

                                Comment

                                Working...
                                X