Check a signmii
Checking a signmii by program decodes its content and returns it.
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.
URL
https://signmii.com/api/checksignmii?login=&password=&signmii=
login | Your identification code. |
---|---|
password | Your password. |
signmii | The text of the signmii to decode. |
signmii
is the string of characters returned by the getsignmii action.
Add the file checksignmii.php with the following content:
- require_once 'sendhttp.php';
Loads the code of the sendget
function provided by iZend.
- function checksignmii($login, $password, $signmii) {
Defines the function checksignmii
.
$login
is your identification code. $password
is your password.
$signmii
is the string of characters built by the encoding of a signmii.
- $curl = 'https://signmii.com/api/checksignmii';
- $args = array(
- 'login' => $login,
- 'password' => $password,
- 'signmii' => $signmii,
- );
Sets $curl
to the URL of the checksignmii action.
Fills the array $args
with the parameters of the checksignmii action.
NOTE: Replace http
by https
in the URL to encrypt the communication.
- $response=sendget($curl, $args);
Sends the HTTP request with sendget
.
- 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, checksignmii
returns false.
- return $response[2];
- }
Returns the body of the response, i.e. the SHA1 contained by the signmii, the date and the time of creation of the signmii and its serial number.
EXAMPLE
Assuming you have saved the files sendhttp.php and checksignmii.php in the current directory, run PHP in interactive mode, load the checksignmii
function and call it with your identification code, your password and a signmii in argument:
$ php -a
php > $signmii='uIWPRlfPaB8VgkTHIg8IoTe72WtTLgL_vGoWjY8PfM9fFjwXb8LmvMsMGKVUUTvJOy-z536BC-GMCOaDDdHhcWqGEYyUlXULwwGBXQL7drGnnbTa0H4bCD1YME6H9q7xIdMqlD9pIS-CIAsAo1SYguOhHP9bBlZ_7vk91gmKmxJQi6ril_UlvUmvmjJbUSnoyvDBLPcOWTa0hPDiPKnLifaimHHzkKfLtD9Ck2DAam9G3q3ME0zayVOTTlFdyPsOwvM6SvOMqAi-iBV40Bg5Ky4wKJztDMiCCBCdx3k-jvMfVtZM61MoIDNaICeI59UYE-HL8cPX3CcRphXYdFmRHg';
php > require_once 'checksignmii.php';
php > echo checksignmii('abcdef', 'ABCDEF', $signmii);
ed0847ae3231350b0153cd8b9c8f56b87ab37801 2014-05-19T21:36:11Z 0000000000000001
php > echo sha1('signmii');
ed0847ae3231350b0153cd8b9c8f56b87ab37801
php > quit
Comments