This is a very basic and simple PHP client implementation for the official Guild Wars 2 API. Somewhen around the 15th of May, 2013, ArenaNet announced the official Guild Wars 2 API, offering developers to create services based on the official RESTful interface to the Guild Wars 2 world.
To run the API on your local development on http://localhost/ just follow these 4 simple steps:
- Copy or extract the API client to your webserver directory.
- Copy ./config-dist.php to ./config.php and fill in the values (Just 2 values: API endpoint and version)
- Create a ./cache directory and chmod it to 777
- Open http://localhost/test.php in your browser
This should result in the following:
- 4 cache files (*.json) should reside in your cache folder
- The website in the browser should display all events in my homeworld (Riverside [DE]), their regional occurrence and their status
Now, go and develop some more, have fun!
I set up a small demo on my own website, showing all events from Riverside [DE] with a cache update of 15 minutes.
There's not much troubleshooting at the moment. Your PHP installation will require allow_url_fopen set to On and your localhost should be able to request resources from the internet. If you get cache write errors, you should check whether the read/write settings for the ./cache directory are correctly set to 777.
Though not required to run the API client, I have included a simple but solid filesystem caching mechanism, writing the JSON response to local files, to save bandwidth and both, yours as well ArenaNet's resources. Please use caching (especially while developing). Read the phpdoc comments to learn about the cache's requirements.
I am a former Guild Wars 2 player, playing very rarely now. But I love the open web and especially open APIs. I just put together these simple libraries to help other developers get into more serious API development. I am not sure whether I'll find the time to take this project to next levels, but I will keep you informed here. Feel free to fork this library and make it your own. In fact, it's all ArenaNet's work and we can have fun thanks to them!
However, here's the official API terms of use: These API's are wholly owned by ArenaNet, LLC ("ArenaNet"). Any use of the API's must comply with the Website Terms of Use and Content Terms of Use, however you may use the API's to make commercial products so long as they are otherwise compliant and do not compete with ArenaNet. ArenaNet may revoke your right to use the API's at any time. In addition, ArenaNet may create and/or amend any terms or conditions applicable to the API's or their use at any time and from time to time. You understand and agree that ArenaNet is in the process of developing a full license agreement for these API's and ArenaNet will publish it when it is complete. Your continued use of the API's constitutes acceptance of the full license agreement and any related terms or conditions when they are posted.