Wednesday, March 26, 2014

check domain name availability with httpapi php


In this post we explain you that how you can check domain name availability using httpapi.com api with php and returns domain name availability status for the requested TLDs. It requires GET HTTP Method. You need following parameters:

auth-userid => your reseller id 
api-key or auth-password => your api code / account password
domain-name => Array of Strings -  that you need to check the availability for
tlds => Array of Strings - TLDs for which the domain name availability needs to be checked
suggest-alternative (optional) => pass "true" if domain name suggestions are required. Default value is false. 

After api call, you will be get the below details in response:

Domain Availability Status (status)

available - domain name available for registration

regthroughus - domain name currently registered through the Registrar whose connection is being used to check the availability of the domain name

regthroughothers - domain name currently registered through a Registrar other than the one whose connection is being used to check the availability of the domain name. If you wish to manage such a domain name through     your Reseller / Registrar Account, you may pass a Domain Transfer API call

unknown - returned, if for some reason, the Registry connections are not available. You should ideally re-check the domain name availability after some time.


For API Call, you can use following php function.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/




function Check_Domains()
{

 # 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
 
 $domainname1 = 'enter any keyword without space'; // first domain name (example: google)
 $domainname2 = 'keyword2'; // second domain name (example: facebook)

 // top level domains 
 $tld1 = 'com'; 
 $tld2 = 'net';  

   $check_domains = $api_url.'/api/domains/available.json?auth-userid='.$auth_userid.'&api-key='.$api_key.'domain-name='.$domainname1.'&domain-name='.$domainname2.'&tlds='.$tld1.'&tlds='.$tld2;

   $result = @file_get_contents($check_domains);
   $response = json_decode($result, true);
            if($response)
            {   
                return $response;
            }
            else
            {
                return false;
            }


}



?>


Function USAGE

<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/



 
 $_details = Check_Domains();
 
    if($_details)
    {
     echo "
";
        print_r($_details);
        echo "
"; } else { echo ""; } ?>

Monday, March 17, 2014

get sub reseller's promo prices httpapi php


In this post we explain you that how you can get sub-reseller's promo prices using httpapi.com api with php and returns the prices details. It requires GET HTTP Method. You need auth-userid and api-key or auth-password parameters for do that. You will be get the below details in response:

Reseller Id (resellerid)
Product Key (productkey)
Promo Start Time (starttime)
Promo End Time (endtime)
Promo Period (period)
Discounted Price (resellerpriceone)
Standard Price (resellerpricetwo)
Customer Price (customerprice)
Barrrier Price (barrierprice)
Price Applicable to the Sub-Reseller (resellerprice)
Type of Action the Promo is Applicable for (actiontype)
Selling Currency of the Registration Service Provider (serviceprovidersellingcurrency)
Promo Status (isactive)
Whether the Promo can be trickled down the Sub-Reseller chain (istrickleallow)

In case of any errors, a status key with value as ERROR alongwith an error message will be returned. For Promo Prices you can use following function.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/


function Promo_Prices()
{

 # 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

   $promodetails = $api_url.'/api/resellers/promo-details.json?auth-userid='.$auth_userid.'&api-key='.$api_key;
   $result = @file_get_contents($promodetails);
   $response = json_decode($result, true);
            if($response)
            {   
                return $response;
            }
            else
            {
                return false;
            }


}


?>

Function USAGE

<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/



 
 $prices_details = Promo_Prices();
 
    if($prices_details)
    {
     echo "
";
        print_r($prices_details);
        echo "
"; } else { echo "Invalid request."; } ?>

Thursday, March 13, 2014

how to authenticating a token httpapi php

In this blog post we explain you that how you can authenticates the token generated by the Generate Token method for customer using httpapi.com api and returns the Customer details, if token authenticated. It requires GET HTTP Method. You need auth-userid, api-key or auth-password, and token parameters for process. If the token is authenticated then you will be get the below customer details in response:


Customer Id (customerid)
Customer Username (username)
Reseller Id of the Parent Reseller (resellerid)
Name (name)
Company (company)
Email Address (useremail)
Telephone Number Country Code (telnocc)
Telephone Number (telno)
First line of address of the Customer (address1)
Second line of address of the Customer (address2)
Third line of address of the Customer (address3)
City (city)
State (state)
Country Code (country)
ZIP Code (zip)
Personal Identification Number (pin)
Creation Date (creationdt)
Current Status (customerstatus)
Sales Contact Id (salescontactid)
Language Preference for the Control Panel and Emails (langpref)
Total Receipts (totalreceipts)

In case of any errors, a status key with value as ERROR alongwith an error message will be returned. For Authenticating a Token you can use following function.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/

function AUTHENTICATE_TOKEN($token)
{

 # 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($token))
   {

   $check_token = $api_url.'/api/customers/authenticate-token.json?auth-userid='.$auth_userid.'&api-key='.$api_key.'&token='.$token;
   $result = @file_get_contents($check_token);
   $response = json_decode($result, true);
   return $response;
 }

 return false;

}

?>

Function USAGE

<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/
 
 $_customer = AUTHENTICATE_TOKEN("token");
 
    if($_customer)
    {

     // Customer details if the token is authenticated

     print_r($_customer);

                              
    }
    else
    {
        echo "Invalid token.";
    }

?>

how to generate a token httpapi php

Generating a Token for customer using httpapi.com api. It requires GET HTTP Method. You need auth-userid, api-key or auth-password, username, passwd and ip parameters for that. You can authenticates a customer by returning an authentication token on successful authentication. In case of any errors, a status key with value as ERROR alongwith an error message will be returned. For this you can use following function. We hope you like that code.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/




function GENERATE_TOKEN($username,$passwd)
{

 # 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($username) && isset($passwd))
   {

   $client_ip = $_SERVER['REMOTE_ADDR']; 

   $generate_token = $api_url.'/api/customers/generate-token.json?auth-userid='.$auth_userid.'&api-key='.$api_key.'&username='.urlencode($username).'&passwd='.urlencode($passwd).'&ip='.$client_ip;
   $result = @file_get_contents($generate_token);
   $token = json_decode($result, true);
   return $token;

 }

 return false;

}


?>

Function USAGE

<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/



 $_token = GENERATE_TOKEN("send_username","send_passwd");
 
    if($_token)
    {

     // token successful authentication
     // after generating a token you need to Authenticating a Token this will be our next post
                              
    }
    else
    {
        echo "Invalid Username or Password.";
    }


?>

how to register customer httpapi curl php

Signing Up a Customer Account using the httpapi.com api. It requires POST HTTP Method. You can use following function to register customer account with api intergration. You need auth-userid and api-key or auth-password for that. Look at follow code for more information.


<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/




function SIGNUP_CUSTOMER($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/customers/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['address-line-1']).'&city='.urlencode($_data['city']).'&state='.urlencode($_data['state']).'&country='.urlencode($_data['country']).'&zipcode='.urlencode($_data['zipcode']).'&phone-cc='.urlencode($_data['phone-cc']).'&phone='.urlencode($_data['phone']).'&lang-pref=en');



  // receive server response ...
  curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
  $server_output = curl_exec ($handle);
  curl_close ($handle);


  // echo $server_output;
  if( strpos($server_output,'ERROR') === FALSE)
  {
   echo "You're Almost Done. Your sign up  process is completed.";
   return true;
  }
  else
  {
   echo "".$server_output."";
  }

 }

 return false;


}

?>

Function USAGE
<?php
/*
Online PHP Examples with Source Code
website: http://4evertutorials.blogspot.in/
*/




 
    if($_SERVER["REQUEST_METHOD"] == "POST")
    {

       SIGNUP_CUSTOMER($_POST);
                              
    }
    else
    {
        $_POST = NULL;
    }

?>


 

© 2014 4everTutorials. All rights resevered.

Back To Top