The following script returns the domain if its available.
Ive been trying to get it to return a not available gif by inserting an else clause inside this part
if ( strstr($linein, "DOMAIN.AVAILABLE.GIF") )
{
echo "<img src=\"images/domava.gif\"><br><br>";
echo "<B>".$domain.".".strtolower($ext)."</B> is available - ";
echo "<a href=\"promotion2.php?domain=".$domain.".".strtolower($ext)."\">Click here</A> to go to the next stage<P>";
//my insertion
else {
echo"my not available gif html code escaped where necessary";
}
}
//end of my insertion
this generates a parse error
its beginning to drive me bananas, ive tried using if !$domain in a feeble attempt to say to the browser "hello these variables returned empty so print this instead"
How can i get it to return my not available gif when the persons target domain isnt available?
//the full script minus my else clause
function whois($domain, $server="www.whois.co.uk")
{
$exts=array(".co.uk");
for ( $loop=0; $loop<count($exts); $loop++ )
{
$fp=fsockopen ($server, 80, &$errnr, &$errstr) or die("$errno: $errstr");
$getstr="GET http://www.whois.co.uk/cgi-bin/whois.pl?query=".$domain."&D1=".$exts[$loop]."&Go.x=7&Go.y=7 HTTP/1.0 \n\n";
fputs($fp, $getstr);
$ext=".non";
while (!feof($fp))
{
$linein=strtoupper(fgets($fp, 2048));
if ( strstr($linein, strtoupper($domain)) )
{
$bits=explode("-", $linein);
$bobs=explode(".", $bits[1]);
if ( strncmp(strtoupper($bobs[2]), "UK", 2) == 0 )
{
$ext=$bobs[1];
$ext.=".".substr($bobs[2], 0, 2);
}
else
{
$odds=explode(" ", $bobs[1]);
$ext=$odds[0];
}
}
if ( strstr($linein, "DOMAIN.AVAILABLE.GIF") )
{
echo "<img src=\"images/domava.gif\"><br><br>";
echo "<B>".$domain.".".strtolower($ext)."</B> is available - ";
echo "<a href=\"promotion2.php?domain=".$domain.".".strtolower($ext)."\">Click here</A> to go to the next stage<P>";
}
}
fclose($fp);
}
return(1);
}
if ( isset($domain) )
{
$bits=explode(".", $domain);
$domain=$bits[0];
whois($domain);
}
?>
tia
rob