1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

[Downlad] % URL Status Checker - 100% Free

Discussion in 'Programming' started by Vooler, Jul 5, 2008.

  1. #1
    As per request of a member, I wrote this script, that returns code that is received as http response from remote domain. This may be used to check either site is alive or dead or has any error.

    Simple example:
    get_url_status("http://www.digitalpoint.com") or die("Site not active at the moment");
    PHP:
    Download: ATTACHMENT
    or try THIS MIRRIOR LINK

    Details:

    I hope it helps.

    regards
     

    Attached Files:

    Vooler, Jul 5, 2008 IP
  2. King Goilio

    King Goilio Member

    Messages:
    200
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    33
    #2
    I have found a bug on line 65 the host should be the website you a trying to cheak
     
    King Goilio, Jul 5, 2008 IP
  3. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #3
    Thanks for information, simply replace www.apitalk.com with $info[host]

    regards
     
    Vooler, Jul 5, 2008 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4

    Attached Files:

    Vooler, Jul 6, 2008 IP
  5. projectWORD

    projectWORD Active Member

    Messages:
    287
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #5
    Thanks a lot!
    Can I get a "THIS MIRROR LINK PLEASE", the above link doesn't seem to work, it says its not a valid archive.



     
    projectWORD, Jul 6, 2008 IP
  6. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
  7. projectWORD

    projectWORD Active Member

    Messages:
    287
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #7
    No Luck, here is the script I use. Your script does work but I do not know why it takes so long or maybe hits an infinite loop.

    <?
    $dbhost = 'MYSERVER';
    $dbname = 'Z';
    $dbuser = 'Y';
    $dbpasswd = 'X';

    include 'url_status.inc';

    // Connect to mysql server
    $connect = mysql_connect($dbhost,$dbuser,$dbpasswd);
    if ( !$connect )
    die( "Couldn't connect to MySql");

    //Select user database
    mysql_select_db($dbname) or die ("Couldn,t open $database");

    $SQL2 = "SELECT * FROM orders";
    $result = mysql_query($SQL2);
    while ($db_field = mysql_fetch_assoc($result)) {
    $url_def = $db_field['url'];




    if($return_code = get_url_status($url_def))
    {
    print "Site is allive, returned - $return_code"; #success
    }
    else
    {
    print "Site returned error - $return_code"; #error
    }
    }
    ?>
     
    projectWORD, Jul 6, 2008 IP
  8. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #8
    You must atleast test with single url first. If that works, I will give you code for multiple, the one you are doing is killing the server lol, dont mind. You even did not pass the timeout whih is by default 10 seconds. And if your database has 100 urls, 100*10 = 1000 seconds, each hit spends 1000 seconds means, server goes down within few minutes.


    regards
     
    Vooler, Jul 6, 2008 IP
  9. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #9
    Can this script be used on proxy listing site?
    I mean, can I make the site query all the urls in my database, and simply show on the site how many are live and how many are dead. is this possible?
     
    proxywhereabouts, Jul 11, 2008 IP
  10. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #10
    Yes possible, that is exactly what projectWORD is trying to do. I will provide example soon.

    regards
     
    Vooler, Jul 11, 2008 IP
  11. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #11
    Cool, perhaps you could drop me a reminder on my PM about this.
    Thanks. :D
     
    proxywhereabouts, Jul 11, 2008 IP
  12. proxywhereabouts

    proxywhereabouts Notable Member

    Messages:
    4,027
    Likes Received:
    110
    Best Answers:
    0
    Trophy Points:
    200
    #12
    Vooler, can you provide me a sample or the script that I can use with my proxy listing site?
    Thanks.
     
    proxywhereabouts, Jul 19, 2008 IP
  13. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #13
    Don't use .inc as file extension for PHP files. They can be viewed as plain text in the user's browser. Not that it'd matter in this case, as there isn't any sensitive data, but it's a bad habit and should always be avoided.
     
    nico_swd, Jul 19, 2008 IP
    Vooler likes this.
  14. nihangshah

    nihangshah Prominent Member

    Messages:
    5,536
    Likes Received:
    271
    Best Answers:
    3
    Trophy Points:
    395
    #14
    Can you post a working demo link?
     
    nihangshah, Jul 19, 2008 IP
  15. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #15
    A user posted some link, I think that is not working now. I will prepare one.

    regards
     
    Vooler, Jul 29, 2008 IP
  16. Glamtronic

    Glamtronic Banned

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #16
    this will come in handy :)
     
    Glamtronic, Aug 25, 2008 IP
  17. iLife

    iLife Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    thanks so much, great script
     
    iLife, Jan 2, 2009 IP