Forum Moderators: coopster

Message Too Old, No Replies

php variable post whois_class to check domain availibility

         

nishant

11:28 am on Jun 21, 2007 (gmt 0)

10+ Year Member



HI
I am trying to use whois_class to check domain availibility in my domain registration website.I need to pass the available domain to a new page in my site so that it can then be emailed to me.But...Please help me how to extract the domain name that user has choosen to register.
The script is like this , i need the choosen domain name be available globally in all subsequent pages.Thanx a lot in advance

<?php
include($_SERVER['DOCUMENT_ROOT']."/domain/server_list.php");
include($_SERVER['DOCUMENT_ROOT']."/domain/whois_class.php");
// error_reporting(E_ALL);
$my_whois = new Whois_domain;
$my_whois->possible_tlds = array_keys($servers); // this is the array from the included server list

if (isset($_POST['submit'])) {
$my_whois->tld = $_POST['tld'];
$my_whois->domain = $_POST['domain'];
$my_whois->free_string = $servers[$_POST['tld']]['free'];
$my_whois->whois_server = $servers[$_POST['tld']]['address'];
$my_whois->whois_param = $servers[$_POST['tld']]['param'];
if ($my_whois->process()) {
$test=$this->msg;
header("Location:http://localhost/domain/get.php");
// $url = "http://localhost/domain/get.php?".explode("&",$HTTP_POST_VARS);
//header("Location: $url");

}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Whois class example with redirect</title>
</head>

<body>
<h2>Whois domain name check with redirect </h2>
<p>Check here only the domain name availability, <br>
if the domain name is free you will be redirected to a external page.<br>
</p>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="form">
<input type="text" name="domain" size="14" maxlength="63" value="<?php echo (isset($domain))? $domain : "";?>">
<?php echo $my_whois->create_tld_select(); // this method generates the select menu woth all tld's?>
<input type=hidden name=reg value=domain>
<input name="submit" type="submit" value="Check">
</form>
<p><?php echo ($my_whois->msg!= "")? $my_whois->msg : "";?></p>

</body>
</html>

Habtom

11:55 am on Jun 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have taken part of your code in order for you to achieve what you wanted:

<?php
echo ($my_whois->msg!= "")? $my_whois->msg : "";
echo "<br>";
$domain_searched = $_REQUEST['domain'].".".$_REQUEST['tld'];
echo $domain_searched;
//mail() Use the mail function here to send it to you.
?>

See how to use mail function on this link [php.net]

Habtom

11:55 am on Jun 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And btw, welcome to Webmasterworld.

Habtom

nishant

12:24 pm on Jun 21, 2007 (gmt 0)

10+ Year Member



HI
thanx
But i need to make a new form in another page along with
searched domain and then mail to me with all the informations.So can i use this code in a new page?

Habtom

12:41 pm on Jun 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should be fine in a new page:

$domain_searched = $_REQUEST['domain'].".".$_REQUEST['tld'];

$to = "youremail@email.com";
$subject = "Searched domain." ".$domain_searched;
$headers =

mail($to,$subject,$domain_searched,$headers);

Write the headers yourself, put your email address in $to and more or less the code should be fine.

Habtom

nishant

5:49 pm on Jun 21, 2007 (gmt 0)

10+ Year Member



Thanx for your help , but still i am not able to get the searched domain. Please help me .I used this in my get.php page

<?php
echo ($my_whois->msg!= "")? $my_whois->msg : "";
echo "<br>";
$domain_searched = $_REQUEST['domain'].".".$_REQUEST['tld'];
echo $domain_searched;
?>

but it gives no output , it's just a blank page.

eelixduppy

3:28 am on Jun 24, 2007 (gmt 0)



>> but it gives no output , it's just a blank page.

Have you checked your error logs? Odds are there are a few errors sneaking around :)