Difference between revisions of "API Main Page"

(New page: For PHP: Download AoPS.php and AoPS_API_PHP5_Rest.php Include AoPS.php in your code. Instantiate the AoPS Api object with your provided API key and Secret key Call AoPS API methods. Sa...)
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
For PHP:
+
This page has been migrated to https://artofproblemsolving.com/wiki/index.php/API:Introduction
Download AoPS.php and AoPS_API_PHP5_Rest.php
 
 
 
Include AoPS.php in your code.
 
 
 
Instantiate the AoPS Api object with your provided API key and Secret key
 
 
 
Call AoPS API methods.
 
 
 
Sample:
 
<?php
 
require_once 'AoPS.php';
 
 
 
<math>appapikey = 'abcdefghijklmnopqrstuvwxyz123456';
 
</math>appsecret = 'abcdefghijklmnopqrstuvwxyz123456';
 
<math>aops = new AoPS(</math>appapikey, <math>appsecret);
 
 
 
</math>username = <math>aops->api_client->user_get_username();
 
</math>firstname = <math>aops->api_client->user_get_firstname();
 
if (</math>username === FALSE || <math>firstname === FALSE)
 
{
 
    echo "Invalid user";
 
}
 
else
 
{
 
    echo "Hello " . </math>firstname . "! Your username is " . $username;
 
}
 

Latest revision as of 19:57, 10 April 2020