Thread: php coding help
View Single Post
Old 19-02-2010, 10:52:57 AM     #3 (permalink)
lwoody

 
Join Date: Dec 2009
Location: London
Posts: 117
lwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud oflwoody has much to be proud of
Classified Rating: 100% (1)

PHP Code for grabbing IPS TAG...easy switch to get Date

This is a part of a script that i wrote where you can dump in a list of domains or keywords (if it's keywords it'll remove spaces and switch it to .co.uk and .com) it'll then go fishing to see if it's been registered or not. This part of the script opens up a the uk nic page and grabs the IPS tag and updates the database.

Code:
<?php require_once('Connections/db_conn.php'); ?>
<?php
mysql_select_db($database_domains_conn, $domains_conn);
$query_getdomains = "SELECT * FROM domains WHERE  domains_id = ".$_GET['did']."";
$getdomains = mysql_query($query_getdomains, $domains_conn) or die(mysql_error());
$row_getdomains = mysql_fetch_assoc($getdomains);
$totalRows_getdomains = mysql_num_rows($getdomains);
?>
<?

do {
$domainTypeUK = preg_match("(.co.uk)", $row_getdomains['domains_domain']);
$domainsTypeOther = preg_match("(.com)", $row_getdomains['domains_domain']);
if ($domainTypeUK == 1) 

{
$file = file_get_contents("http://webwhois.nic.uk/cgi-bin/whois.cgi?query=".substr($row_getdomains['domains_domain'],11)."&WHOIS+Submit.x=0&WHOIS+Submit.y=0");
$desc = preg_match("[Tag = (.*)]", $file, $fulldesc);
$ipstag = $fulldesc[1];
$ipstag = str_replace(']', '', $ipstag);
$ipstag = str_replace('[', '', $ipstag);

//echo $fulldesc[1];

$UpdateSQL = "UPDATE domains SET domains_a = '$ipstag' WHERE domains_id = ".$row_getdomains['domains_id']."";

mysql_select_db($database_domains_conn, $domains_conn);
$Result1 = mysql_query($UpdateSQL, $domains_conn) or die(mysql_error());	

if($fulldesc[1] == "") {

echo $row_getdomains['domains_domain']." is avaialble!";

}else{

echo "Domain: ".$row_getdomains['domains_domain']." /n IPS Tag was: ".$row_getdomains['domains_a']." /n IPS Tag is now: ".$ipstag;		
}

}

else if ($domainsTypeOther == 1)

{

$file = file_get_contents("http://reports.internic.net/cgi/whois?whois_nic=".substr($row_getdomains['domains_domain'],11)."&type=domain");
$desc = preg_match("(Registrar:(.*\s))", $file, $fulldesc);

//echo $fulldesc[1];

$UpdateSQL = "UPDATE domains SET domains_a = '".$fulldesc[1]."' WHERE domains_id = ".$row_getdomains['domains_id']."";

mysql_select_db($database_domains_conn, $domains_conn);
$Result1 = mysql_query($UpdateSQL, $domains_conn) or die(mysql_error());	

if($fulldesc[1] == "") {

echo $row_getdomains['domains_domain']." is avaialble!";

}else{

echo "Domain: ".$row_getdomains['domains_domain']." Registrar was: ".$row_getdomains['domains_a']."  Registrar is now: ".$ipstag;		
}
			
}

} while ($row_getdomains = mysql_fetch_assoc($getdomains));		

// echo $domainsTypeOther;

?>
<?php
mysql_free_result($getdomains);
?>
You'd need to change the $desc = preg_match("[Tag = (.*)]", $file, $fulldesc); to look for the date.

Awesome tool for regular expressions lives at http://gskinner.com/RegExr/

Lee

Last edited by lwoody; 19-02-2010 at 11:10:16 AM. Reason: added a url
lwoody is offline