Check your subscription
subscription
GET https://collaboractor.com/api/v1/subscription?login=&password=
login | Your identification code. |
---|---|
password | Your password. |
$ curl -D - -X GET "https://collaboractor.com/api/v1/subscription?login=abcdef&password=ABCDEF"
Download the code of the sendget
function defined in the file sendhttp.php.
Copy the file in the space of your application.
NOTE: See the page Call the service API for a description of the sendget
function.
Add the file subscription.php with the following content:
- require_once 'sendhttp.php';
Loads the code of the sendget
function provided by iZend.
- function subscription($login, $password) {
Defines the function subscription
.
$login
is your identification code. $password
is your password.
- $curl = 'https://collaboractor.com/api/v1/subscription';
Sets $curl
to the URL of the subscription action.
- $args = array(
- 'login' => $login,
- 'password' => $password,
- );
Prepares the list of arguments of the GET: the identification code and the password of the user's account.
- $response=sendget($curl, $args);
Sends the HTTP request with sendget
.
The arguments login
and password
are already in $curl
.
- if (!$response or $response[0] != 200) {
- return false;
- }
If $response
is false
, the server is unreachable.
If $response[0]
doesn't contain the HTTP return code 200 Ok, an execution error has occurred.
In case of error, subscription
returns false.
- return $response[2];
- }
Returns the due date of the subscription with the format yyyy-mm-dd
.
EXAMPLE
Assuming you have saved the files sendhttp.php and subscription.php in the current directory, run PHP in interactive mode, load the subscription
function and call it with your identification code and password in argument:
$ php -a
php > require_once 'subscription.php';
php > echo subscription('abcdef', 'ABCDEF');
2023-12-31
php > quit
Comments