Home | Terms | ccTLD Information | Download | Request API Password | How does it work? | PHP Code | Whois
 

Sample PHP (NuSoap) Code     [ dotpk_Whois.php ] - [ dotpk_CheckDomain.php ]


Filename: dotpk_whois.php
    -    Download
<?php
// +----------------------------------------------------------------------+
// | Filename:        dotpk_Whois.php                                     |
// |                                                                      |
// | Version:         0.01  (Dated: February 13, 2006)                    |
// |                                                                      |
// | Copyright:       NONE - You are free to use and modify this code as  |
// |                  you need.                                           |
// |                                                                      |
// | Authors:         Khalil Ahmad <khalil@paksys.com>                    |
// |                  PakSys Software LLC.                                |
// |                                                                      |
// | Description:     This is a sample code to consume PakNIC Whois       |
// |                  Web Service to get .PK domain whois record.         |
// |                                                                      |
// | Returns:         Array of string with complete domain whois detail   |
// |                  and DNS Servers, etc.                               |
// |                                                                      |
// | Change Log:                                                          |
// |                                                                      |
// | Note:            Whois.net.pk web service requires a Username and    |
// |                  and password which you can get free by signing up   |
// |                  at http://whois.net.pk                              |
// +----------------------------------------------------------------------+
//
// Include Nusoap.php file
require_once('lib/nusoap.php');

$strUser   = "";	// <=== Enter your Username as provided by http://whois.net.pk
$strPasswd = "";	// <=== Enter your Password as provided by http://whois.net.pk


$strSLD = "microsoft"; $strTLD = "com.pk"; // Define needed parameters and put them in an array. $parameters[] = array( 'strSLD' => $strSLD, 'strTLD' => $strTLD, 'strUser' => $strUser, 'strPasswd' => $strPasswd ); // Define new object and specify location of wsdl file. $soapclient = new soapclient('http://whois.net.pk/webservice/Whois.asmx?WSDL',True); $err = $soapclient ->getError(); if ($err) { // Display the error echo "client construction error: " . $err ; } else { // call the method and get the result. $result = $soapclient->call('GetWhoisRecord',$parameters); $err = $soapclient ->getError(); if ($err) { // Display the error echo "Call error: <pre>$err"; //print_r($soapclient ->response); //print_r($soapclient ->getDebug()); echo "</pre>"; } else { // Print out a nice formatted return string print_r($result); echo "<hr><pre>".$result["GetWhoisRecordResult"]."</pre><hr>"; } } ?<
 

Filename: dotpk_CheckDomain.php
    -    Download
<?php
// +----------------------------------------------------------------------+
// | Filename:        dotpk_CheckDomain.php                               |
// |                                                                      |
// | Version:         0.01  (Dated: February 13, 2006)                    |
// |                                                                      |
// | Copyright:       NONE - You are free to use and modify this code as  |
// |                  you need.                                           |
// |                                                                      |
// | Authors:         Khalil Ahmad <khalil@paksys.com>                    |
// |                  PakSys Software LLC.                                |
// |                                                                      |
// | Description:     This is a sample code to consume PakNIC Whois       |
// |                  Web Service to check whether a .PK domain is        |
// |                  is available for registration or not.               |
// |                                                                      |
// | Returns:         200  if Domain is Expired / De-activated            |
// |                  210  if Domain is Available                         |
// |                  211  if Domain Taken                                |
// |                  0    if Whois Web Service Authentication Failed     |
// |                  -1   if any Error Occurred while checking domain    |
// |                  -2   if the domain name is Invalid                  |
// |                                                                      |
// | Change Log:                                                          |
// |                                                                      |
// |                                                                      |
// | Note:            Whois.net.pk web service requires a Username and    |
// |                  and password which you can get free by signing up   |
// |                  at http://whois.net.pk                              |
// +----------------------------------------------------------------------+
//
// Include Nusoap.php file
require_once('lib/nusoap.php');

$strUser   = "";	// <=== Enter your Username as provided by http://whois.net.pk
$strPasswd = "";	// <=== Enter your Password as provided by http://whois.net.pk


$strSLD = "microsoft"; $strTLD = "com.pk"; // Define needed parameters and put them in an array. $parameters[] = array( 'strSLD' => $strSLD, 'strTLD' => $strTLD, 'strUser' => $strUser, 'strPasswd' => $strPasswd ); // Define new object and specify location of wsdl file. $soapclient = new soapclient('http://whois.net.pk/webservice/Whois.asmx?WSDL',True); $err = $soapclient ->getError(); if ($err) { // Display the error echo "client construction error: " . $err ; } else { // call the method and get the result. $result = $soapclient->call('CheckDomain',$parameters); $err = $soapclient ->getError(); if ($err) { // Display the error echo "Call error: <pre>$err"; //print_r($soapclient ->response); //print_r($soapclient ->getDebug()); echo "</pre>"; } else { // Print out a nice formatted return string print_r($result); echo "<hr><pre>".$result["CheckDomainResult"]."</pre><hr>"; } } ?<

Contact Us

Copyright © 2005-2008 PAKNIC™.COM. All rights reserved.
Disclaimer: Please note we do not have any affiliation or link with PKNIC (The official .PK Domain Registry) whatsoever. The code and this service is provided as is without any warranty and for public service only. Any illegal use of this service may result in suspension of your account/service and/or may be prosecuted legally. You can use this free service according to our terms and condition as you agreed during download/signup of our code. For domain registration and other domain related policies you must follow PKNIC policy and may contact them directly. You are obliged to mention "Whois.Net.PK" name and URL at your website if you agree to use our free services. The Whois Web Service, API code and any other related document/code downloaded from our site(s) are legal property of PAKNIC.COM. By using our service and website, you agree to our terms & conditions as listed on the website.