RSS feed

Wednesday the 10th
Here is an attempt to offer helpful scripts
More details and downloads to follow shortly

Snippets - WHOIS2 passing IP

To use Nominet whois2 you first have to inform them your server IP address and be granted access. Hosts like a VPS or shared host will sometimes require you to pass its IP address within the script to Nominet. The following script will force the script to use $sourceip via a socket bind command to query Nominet WHOIS2.

Usage is simple by downloading whois.php and updating x.x.x.x with your server IP address which you should have pre informed Nominet and been to granted access.

http://www.localhost.com/whois.php?domain=dailydomain.co.uk

 

<?php
$sourceip = 'x.x.x.x'; // ip you want to bind
$whois = 'whois.nic.uk';
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ip = $_SERVER["REMOTE_ADDR"];
$ref = $_server['HTTP_referer'];

$domain = $_GET["domain"]; // domain to query

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($sock, $sourceip);
socket_connect($sock, "$whois", 1043);

socket_write ($sock, "$hostname $ip $domain\r\n");
$line = socket_read($sock, 2048);

echo str_replace("\n", '<br />', $line);
?>