NamePros.Com (http://www.namepros.com/)
-   Programming (http://www.namepros.com/programming/)
-   -   Check Website Resolves? (http://www.namepros.com/programming/468234-check-website-resolves.html)

peaches017 05-11-2008 10:25 PM

Check Website Resolves?
 
Is there any script out there that can quickly check if a website is resolving?

I need to input a list of domains in .txt format and it should tell me:

Google.com resolves
SampleName.com doesn't resolve

I would be willing to buy this script or pay to have it coded.

Peter

Daniel 05-12-2008 09:35 AM

I just wrote this now.

Cba to sort out port 443 too. Simple change if you want to do it.

PHP Code:
<?php

/**
* Danltn | http://danltn.com/
* MSN: msn@danltn.com
* Email: daniel@neville.tk
* Started: 12/5/2008 17:25 (UK)
* Tested: No
* PHP 4/5: Both
* No warranty is given to code used
*/

define('TIMEOUT', 5);
define('UP_MESSAGE', '%s resolves.');
define('DOWN_MESSAGE', '%s doesn\'t resolve.');
define('LINE_BREAK', "<br />\n");
define('EXTRA_FLUSH', true);

/* Timeout -> Int
* Up_message -> Str
* Down_message -> Str
* Line Break -> Str
* Extra_flush -> Bool
*/

if (isset($_POST['submit']))
{
    
$list = (get_magic_quotes_gpc()) ? stripslashes($_POST['list']) : $_POST['list'];
    
$list = str_replace("\r", '', $list);
    
$urls = explode("\n", $list);
    if (
count($urls) > 0)
    {
        while (list(,
$url) = each($urls))
        {
            if (!
$url)
            {
                continue;
            }
            if (
substr($url, 0, 4) === 'http')
            {
                
$url = preg_replace('https?://', '', $url);
            }
            if (@
fsockopen($url, 80, $errno, $errstr, TIMEOUT))
            {
                
printf(UP_MESSAGE, $url);
            }
            else
            {
                
printf(DOWN_MESSAGE, $url);
            }
            echo
LINE_BREAK;
            if (
EXTRA_FLUSH === true)
            {
                
ob_flush();
                
flush();
            }
        }
    }
    die();
}

?>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
    <textarea rows="20" cols="60" name="list"></textarea><br />
    <input type="submit" name="submit" value="Check" />
</form>


All times are GMT -7. The time now is 09:05 AM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0