This is just some of the scripts we have used in the past. Little or no error checking and some of the URLS have been changed to protect the innocent. You will need to customize this code or just take the logic and convert it to ASP, C, etc.
With these scripts (and a bit of time) you can create a whois search like the one on this site. You can also write a link popularity checking program relatively easily.
If you use any of my scripts we would appreciate a link back to this site.
/* WEB INTERFACE Basically you can do anything with this function. This just shows how to connect to a web server and parse the output. This function can be used to connect to a dictionary website to check your spelling, a store to check the availability of a product..even auctions. Be sure to read the "Terms of Use" (or whatever its called) for each site you will be connectiong to and ask permission. This can be abused and get you banned from servers and services. */ function checkDomain($domain){ $fp = fsockopen("somesearch.com", 80, $errno, $errstr, 30); $domaincount = 0; if (!$fp) { print("$errstr ($errno)\n"); } else { fputs ($fp, "GET /somesearch?domain=$domain HTTP/1.0\r\nHost: somesearch.com\r\n\r\n"); for($i=0;$i<35;$i++) { //change 35 to whatever the minimum required rows are $mystr = fgets($fp,1024); $pos = strpos($mystr, "text before result "); if (!($pos === false)) { $pos2 = strpos($mystr, " textafter result"); $pos += 19; //length of "text before result" $domaincount = trim(substr($mystr,$pos,$pos2-$pos)); break; } } fclose($fp); } return $domaincount; } |
/* WHOIS LOOKUP This is basic code to get you going. There are countless whois servers out there now and not all contain all the information you may be looking for. */ $fp = fsockopen ("whois.someserver.com", 43, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs ($fp, "domain $domainame\r\n"); //your whois server may not support the "domain" call //fputs ($fp, "$domainame\r\n"); while (!feof($fp)){ $mystr = fgets ($fp,500); print $mystr . "<br>"; $pos = strpos($mystr, "Whois Server:"); } fclose ($fp); } |
' ASP WHOIS script : no error checking ' You will need the w3 Sockets component for this to work ' It is free or $25 dollars. ' http://www.duplo.se/ ' Look for products > w3 Sockets Dim tcpSock Dim strRetVal Set tcpSock = Server.CreateObject( "Socket.TCP" ) tcpSock.Host = "whois.internic.net:43" tcpSock.Timeout=100 tcpSock.Open() tcpSock.SendLine ("kdweb.net") tcpSock.WaitForDisconnect() 'Output however you want Response.Write ("<pre>") Response.write (tcpSock.buffer) Response.Write ("</pre>") |
Comments
0 comments
Article is closed for comments.