A Simple PHP API for accessing data from sc2ranks. Still needs some work, let me know if you have any contributions to this project.
See example.php for sample script
-
Include sc2ranks.php
-
Create a new request. You can pass in your app key if you want. If not then your app key will be set to the value of $_SERVER['server_name']. You can use either file_get_contents or curl by passing in a second parameters $method with either "fopen" or "curl", defaults to "fopen" $request = new sc2ranks_request("your site name", "fopen"); or just $request = new sc2ranks_request();
-
Call the get_character_data method of the request object, passing in the character name and character code $request->get_character_data("character name", character code);
-
Call get_bracket_data() to get an object containing a particular bracket record, defaulting to the 1v1 record of the last requested character $request->get_bracket_data();
- Add support for batch requests
- Add demo of new functions
- Add other helper functions for processing returned data
- Add documentation somewhere for the returned object structure
- Add sorted map statistics methods