20.gif

Search (advanced search)
Use this Search form before posting, asking or make a new thread.
Tips: Use Quotation mark to search words (eg. "How To Make Money Online")

07-11-2013, 10:14 AM (This post was last modified: 07-11-2013 10:16 AM by family11.)
Post: #1
[REQ] hi i need help making my api php files
hi i need help making my api files here the following code


License Activation using the “POST” method

Description: Request to validate a license key and also log/write the
user’s data into the database. You have to use this method upon software
activation so InstaMember can count or limit the usage properly.

API End-Point: http://YOURDOMAIN.CO...e/{license_key}

PHP Example:

<?php

$secret_key = ‘YOUR SECRET KEY’; $license_key = ‘LICENSE KEY HERE’;

$md5_hash = md5($license_key . $secret_key);

$api_url = “http://yourdomain.co...$license_key}”;

$hostname = @gethostbyaddr($_SERVER['SERVER_ADDR']); $data = array(

'domain' => $_SERVER['HTTP_HOST'], 'userip' => $_SERVER['REMOTE_ADDR'],

'servip' => ( $hostname ) ? $hostname : $_SERVER['SERVER_ADDR']

);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api_url);

curl_setopt($ch, CURLOPT_USERPWD, "{$secret_key}:{$md5_hash}");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch,
CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch,
CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));

$result = curl_exec($ch); $response = json_decode($result);

If ( $response->status == ‘Success’ ) {

// code to unlock software here…

} else {

// code handling error here…

}

License Validation using the “GET” method

Description: Request to validate the license whether the license is
still active or invalid (e.g. expired, inactive, suspended, etc). This
method does not accept any type of data, and will not log any data into
the database.

API End-Point: http://YOURDOMAIN.CO...e/{license_key}

PHP Example:

<?php

$secret_key = ‘YOUR SECRET KEY’; $license_key = ‘LICENSE KEY HERE’; $md5_hash = md5($license_key . $secret_key);

$api_url = “http://yourdomain.co...$license_key}”;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $api_url);

curl_setopt($ch, CURLOPT_USERPWD, "{$secret_key}:{$md5_hash}");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch,
CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch,
CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

$response = json_decode($result);

If ( $response->status == ‘Expired’ ) {

// the license key is expired… do something here… } else if ( $response->status == ‘Suspended’ ) {

// the license key has been suspended… do something here…

} else {

// do something here…

}

10

Status Types

Success – License key is active or valid

Maxed – License key is active but has reached the maximum usage limit (returned only upon activation)

Expired – License key has expired

Inactive – License key is not active or disabled by admin Suspended –
License key has been suspended by admin Unauthorized – Authentication
request failed

Error – Any type of errors

Response Data Example (in JSON)

License Active/Success:

{

"status":"Success", "message":"License key is active"

}

License Inactive:

{

"status":"Inactive",

"message":"License key is inactive or disabled"

}

License Expired:

{

"status":"Expired",

"message":"License key has been expired"

}

License Maxed:

{

"status":"Maxed",

"message":"License key is active but has reached the maximum usage limit"

}

License Suspended:

11

{

"status":"Suspended",

"message":"License key has been suspended"

}

Authentication Failed:

{

"status":"Unauthorized", "message":"Authentication failed"

}

License key is empty:

{

"status":"Error", "message":"License key is empty"

}

License is not found in the database:

{

"status":"Error", "message":"Invalid license key"

}

No post data upon activation:

{

"status":"Error",

"message":"Required fields are empty"

}

License Keys Management

Simply login to your WordPress Dashboard, and navigate to “InstaMember
-> Manage Licenses.” You can view license keys that has been
generated along with the details, including the member data, associated
product and also the usage log. You can also “deactivate” or
“reactivate” or “delete” a license key from this page.


please help me with this. the first person that have it done for me asap
i will give you 100 commission on the product once we launch.
08-13-2013, 05:52 PM
Post: #2
RE:
did you ever get this solved?
08-13-2013, 06:12 PM
Post: #3
RE:
(08-13-2013 05:52 PM)m45741314574 Wrote:  did you ever get this solved?
no can you help me please with this thanks




28.gif