DELAVO & WP PLUGIN authorization

Article Tools

You can connect WordPress plugin with DELAVO so only authorised members of a specific membership can use the plugin. Here is how to do that:

First create an API record for the membership.

Each API record has a gate id and secret key against which the membership’s members are subscribed.

So the plugin will need to ping that url using the CURL library and supply the username and password. In return DELAVO reports a ‘Success’ or an or error value.

Refer to the API documentation for the complete DELAVO API instructions.

Below is listed a sample PHP code you can use.

//get all categories and verify the login one by one.
//sample DELAVO membership url for testing:
//http://YOUR-DOMAIN.com/DELAVO-DIRECTORY/action/Jin/APIUser/authorize.txt?gate_id=GATE-ID&secret=SECRET-WORD&email=<EMAIL>&password=<PASSWORD>

$pwdurl = <<DELAVO MEMBERSHIP URL>>;
$pwdurl = str_replace("<EMAIL>", $user, $pwdurl);
$pwdurl = str_replace("<PASSWORD>", $pass, $pwdurl);

if($pwdurl != null)
{
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $pwdurl);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
$resp = strtolower( curl_exec( $ch ) );
curl_close($ch);
if ( strpos( trim( strtoupper($resp) ), "SUCCESS" ) === false )
{
$isvalid = 0;
}
else
{
$isvalid = 1;
}
}
else
{
header("location: memberlogin.php?status=".base64_encode("loginfailed"));
}

Previous postUsing DELAVO for sales via forums, etc. Next postAweber integration

Related Posts