Irgenwie komme ich nicht weiter. Ich habe mir aus Matts whois-Script ein paar Funktionen raus genommen, bekomme aber keine Ausgabe hin. Das komplette Whois-Script von Matt habe ich mal als zip angehangen.
Und hier nun mein Script:
Und hier nun mein Script:
PHP-Code:
<?
$dom = "yahoo";
$ex = "com";
load_server_info();
//choose_info_server($dom, $ex);
// some extensions (com/net/org) have a server which contains the name of the server which should be used for the information, this simply tells the script to use the whois server as a source for the server info... ;)
$whois_si_servers = array();
// an array of the `whois' servers
$whois_servers = array();
// default whois servers for info
$whois_info_servers = array();
// the backup whois servers to try
$whois_info_servers_backup = array();
function my_in_array($val,$array_)
{
for($l=0; $l<sizeof($array_); $l++)
{
if($array_[$l] == $val)
{
return 1;
}
}
return 0;
}
// in case the theme can't be found
function fatal_servers_lst()
{
echo '<HTML><BODY><FONT FACE=VERDANA SIZE=2>MWhois could not locate the servers.lst\ file in the current directory!</FONT></BODY></HTML>';
exit();
}
function load_server_info()
{
global $whois_si_servers;
global $whois_servers;
global $whois_info_servers;
global $whois_info_servers_backup;
global $whois_avail_strings;
// load the servers.lst file
$tlds = @file("servers.lst");
if(!$tlds)
{
fatal_servers_lst();
}
for($l=0; $l<count($tlds); $l++)
{
// time leading spaces or trailing spaces
$tlds[$l] = chop($tlds[$l]);
// filter out the commented lines (begin with #)
if(substr($tlds[$l], 0, 1) == "#" || !strlen($tlds[$l]))
{
continue;
}
// explode via the seperation char `|'
$es = explode("|", $tlds[$l]);
// check to see whether we want this TLD
if(!my_in_array($es[0], $whois_exts)) { continue; }
// yes we do, so store the details in the appropriate arrays
$whois_servers[$es[0]] = $es[1];
$whois_si_servers[$es[0]] = $es[5];
$whois_info_servers[$es[0]] = $es[3];
$whois_info_servers_backup[$es[0]] = $es[4];
$whois_avail_strings[$es[1]] = $es[2];
// thats it!
}
}
function choose_info_server($domain, $ext)
{
global $whois_info_servers;
global $whois_si_servers;
global $whois_server;
global $whois_servers;
$whois_server = "";
if($whois_si_servers[$ext])
{
if(($co = fsockopen($whois_servers[$ext], 43)) == false)
{
echo "\n choose_info_server() : unable to connect to ".$whois_servers[$ext];
$whois_server = $whois_servers[$ext];
}
else
{
echo "\n choose_info_servers() : connected to ".$whois_servers[$ext]." looking for `".$whois_si_servers[$ext];
fputs($co, $domain.".".$ext."\r\n");
while(!feof($co)) { $output .= fgets($co,128); }
fclose($co);
$he = strpos($output, $whois_si_servers[$ext]) + strlen($whois_si_servers[$ext]);
$le = strpos($output, "\n", $he);
$whois_server = substr($output, $he, $le-$he);
echo "\n choose_info_servers() : found '".$whois_server."' using for whois info server";
}
}
else
{
$whois_server = $whois_info_servers[$ext];
echo "\n choose_info_servers() : not found '".$whois_server."' using for whois info server";
}
$whois_server = trim($whois_server);
}
choose_info_server($dom, $ex);
echo"<p> </p>Ausgabe:<pre>$whois_server</pre>
Whois-Server:<pre>$whois_servers[$ext]</pre>";
echo "<hr>";
//show_source("domain.1.php");
?>
Kommentar