|
Posted by Krustov on 10/28/06 01:12
<comp.lang.php>
<Krustov>
<Fri, 27 Oct 2006 20:32:33 +0100>
<MPG.1fac6f1dc34e955b98a11e@news.newsreader.com>
> Like (e.g.) netcraft i'd like to have a form box where a user can type
> in the url of their own website to find out if they have suitable
> windows web hosting or not .
>
Got it - and quite a little mutha to solve for somebody who hasnt got
around to learning the likes of fopen etc .
<?php
$domain="www.example.com";
$fp=fsockopen($domain,80,$errno,$errstr,30);
if (!$fp) {print "$errstr ($errno)<br>\n";}
else
{
$gt="";
$out = "HEAD / HTTP/1.1\r\n";
$out .= "Host: $domain\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {$gt=$gt . fgets($fp, 128);}
fclose($fp);
}
$chevy=strtolower($gt);
$passurl=0;
$wurd="server: microsoft";
$yesno=strpos($chevy,$wurd); if ($yesno==true) {$passurl=1;}
$wurd="server: apache";
$yesno=strpos($chevy,$wurd); if ($yesno==true) {$passurl=2;}
if ($passurl==0) {print "<br><br>"; print "PROBLEM CHECKING THE DOMAIN -
UNKNOWN";}
if ($passurl==1) {print "<br><br>"; print "YES - YOU HAVE SUITABLE
WEBSPACE";}
if ($passurl==2) {print "<br><br>"; print "NO - YOU DONT HAVE SUITABLE
WEBSPACE";}
?>
Navigation:
[Reply to this message]
|