This is a very simple client for AgoraPI, based on PHP with php-curl
library.
It is intended to demonstrate and test voting functionality of AgoraPI, the Open Agora polling API.
It complements the AgoraPI guide and the exhaustive documentation, please make sure to read these pages before starting using the present files.
This code is not intended for production use.
In order to use the files of this repository, you need the following:
- An AgoraPI access key (and the associated token). You may register on Open Agora website for free.
- PHP installed on your machine (or some server). More precisely, you need PHP CLI and PHP Curl above 5.4. We recommend using PHP 7.
- Having a running web server like Apache or Nginx is optional since you may try our code with PHP built-in server.
- That's about it. In case of trouble you may get in touch with us: agorapi@open-agora.com
Assume the downloaded files are located within folder /agorapiTestClient/
.
- Clone the repository or copy the files into some directory.
- Move file
/agorapiTestClient/OA/api_dist.ini
to/agorapiTestClient/OA/api.ini
. This file contains essential information for accessing AgoraPI. - Edit
/agorapiTestClient/OA/api.ini
and fill in your API token obtained from your profile at Open Agora website. - Within directory
/agorapiTestClient/
, you may simply type:php -S localhost:8888 -t .
. You should keep this server running in a console. - In a browser, go to http://localhost:8888/poll_index.php.
Alternatively, you may configure Apache or Nginx to access directory /agorapiTestClient/
from a given URL.
The files in this repository present some aspects of building a client for AgoraPI. However, we do not get deeply into every functionality of this API.
In particular, elements related to user management are omitted. AgoraPI makes it possible to have users, who may create polls and cast votes (each user may cast at most a single vote for a given poll, this vote can be replaced as often as necessary). In order to make optimal usage of AgoraPI, you should understand how users are handled, and what they are entitled to do. It is also important with respect to anonymous voting.
This project is licensed under the MIT License - see the LICENSE.md file for details.