• Login
  • Become a blogger
  • PHP Script – Open port check

    Posted by thinkdj on November 16th, 2007
    5 Comments | 6,891 pageviews

    Got this from Vinu’s blog. This simple script will attempt to connect to the site:port using fsockopen to determine if a service is running on the port.

    < ?php

    $site = "vinuthomas.com";
    $port = 80;

    $fp = fsockopen($site,$port,$errno,$errstr,10);
    if(!$fp)
    {
    echo "Cannot connect to server";
    }

    else{
    echo "Connect was successful - no errors on Port ".$port." at ".$site;
    fclose($fp);
    }

    ?>

    5 Responses »

    1. reishi says:

      hi admin
      how about por 21 ?

    2. Mauricio says:

      Thanks, very useful

    3. MakiS says:

      hmhm nC.. u can make better :)

    4. Kumaran says:

      Thanks a lot. Good Work

    Trackbacks/Pingbacks

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    More from "PHP"

    Find what you are looking for

    Recently added

    Categories

    Blogulate

    Keeping you updated of the latest fads and developments of the industry via amalgamated web content.

    Join us

    Post articles on blogulate and monetize them. Learn more »

    Stay updated

    Subscribe now and stay aware of the latest trends and happenings on the www. Get notified via email when we update.

    Enter your email address:

    Blogulate is based on Magnus premium theme by WizeDesigns
    © 2009 Blogulate. Some rights reserved.