Signing Up a Sub-Reseller Account using the httpapi.com api. It requires POST HTTP Method. You can use following function to register sub reseller with api intergration. You need auth-userid and api-key or auth-password for that. Look at code for more.
<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
function SIGNUP_RESELLER($data)
{
// post all required data through via $_POST in $data
$_data = $data;
# API Url: for test=>https://test.httpapi.com , for live=>https://httpapi.com
$api_url = 'https://test.httpapi.com';
$auth_userid = ''; // reseller unique id
$api_key = ''; // api-key or reseller password
if(isset($auth_userid) && isset($api_key))
{
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL,$api_url.'/api/resellers/signup.xml');
curl_setopt($handle, CURLOPT_POST, 1);
curl_setopt($handle, CURLOPT_POSTFIELDS,
'auth-userid='.$auth_userid.'&api-key='.$api_key.'&username='.urlencode($_data['username']).'&passwd='.urlencode($_data['passwd']).'&name='.urlencode($_data['name']).'&company='.urlencode($_data['company']).'&address-line-1='.urlencode($_data['address1']).'&city='.urlencode($_data['city']).'&state='.urlencode($_data['state']).'&country='.urlencode($_data['country']).'&zipcode='.urlencode($_data['zip']).'&phone-cc='.urlencode($_data['telnocc']).'&phone='.urlencode($_data['telno']).'&lang-pref='.$_data['langpref'].'&accounting-currency-symbol='.$_data['accountingcurrencysymbol'].'&selling-currency-symbol='.$_data['sellingcurrencysymbol'] );
// receive server response ...
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec ($handle);
curl_close ($handle);
// echo $server_output;
if( strpos($server_output,'AlreadyReseller') === FALSE)
{
echo "You're Almost Done. Your Sub-Reseller Account has been successfully registered.";
return true;
}
else
{
echo "".$_data['username']." Already Reseller";
}
}
return false;
}
?>
USAGE
<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
if($_SERVER["REQUEST_METHOD"] == "POST")
{
SIGNUP_RESELLER($_POST);
}
else
{
$_POST = NULL;
}
?>






1 comments:
nice post. whiich section of my website do i paste the codde.
Post a Comment