Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    P.o.X
    P.o.X is offline
    Member-in-training P.o.X's Avatar
    Join Date
    2012 May
    Posts
    64
    Thanks Thanks Given 
    11
    Thanks Thanks Received 
    11
    Thanked in
    7 Posts
    Rep Power
    0

    Question Php UDP or TCP port checker M.C

    Hey,I have a problem for days i`m searching on a script php port check if is open or closed to use on my website,
    the thing is idk how to create one or find one the cript i mean,If someone knows how to,i tryed all scripts no one works
    if someone knows how to..
    I want to put server status on my enter page of M.C but i have problems.the port is 25565
    and ip is 85.122.110.66 please i need a script.

  2. #2
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    Here is my function on my framework.

    PHP Code:
    public static function serverStatus($ip,$port,$timeout 1)
    {
            try
            {
                
    $status fsockopen($ip,$port,$errno,$errstr,$timeout);
                if(!
    $status)
                {
                    return 
    "OFF";
                }
                else 
                {
                    return 
    "ON";
                }
            }
            catch(
    Exception $e)
            {
                      return 
    "OFF";
            }

    you can change return to true or false; depend on how u check it...
    if you want to use it

    PHP Code:
    if(serverStatus(ip,port,[optional timeout]) == "ON")
    {
       
    tell server on
    }
    else
       
    server off 
    i hope it will help you...
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  3. #3
    P.o.X
    P.o.X is offline
    Member-in-training P.o.X's Avatar
    Join Date
    2012 May
    Posts
    64
    Thanks Thanks Given 
    11
    Thanks Thanks Received 
    11
    Thanked in
    7 Posts
    Rep Power
    0
    emoisback ok i see the script but never learned php just DB,MYSQL connections.
    can u give me an example please use this ip 85.122.110.66 and this port 25565,ty

  4. #4
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    First put the function in a top of php file

    dont forget to put
    PHP Code:
    <?php
    in the begin and
    PHP Code:
    ?> 
    in the end..

    to call the function :
    PHP Code:
    if(serverStatus(85.122.110.66,25565,60) == "ON")
    {
       echo 
    "Server is UP";
    }
    else
       echo 
    "Server is Down"
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  5. #5
    P.o.X
    P.o.X is offline
    Member-in-training P.o.X's Avatar
    Join Date
    2012 May
    Posts
    64
    Thanks Thanks Given 
    11
    Thanks Thanks Received 
    11
    Thanked in
    7 Posts
    Rep Power
    0
    i get this error Parse error: syntax error, unexpected T_DNUMBER in /home/a2725571/public_html/status.php on line 2

  6. #6
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    can you put you status.php here...maybe i can fix it for you...
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  7. #7
    P.o.X
    P.o.X is offline
    Member-in-training P.o.X's Avatar
    Join Date
    2012 May
    Posts
    64
    Thanks Thanks Given 
    11
    Thanks Thanks Received 
    11
    Thanked in
    7 Posts
    Rep Power
    0

    Arrow

    PHP Code:
    <?php
    if(serverStatus(85.122.110.66,25565,60) == "ON")
    {
       echo 
    "Server is UP";
    }
    else
       echo 
    "Server is Down";  
    ?>

  8. #8
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    azz where is the code for the serverStatus >,< thats all your code in status.php

    PHP Code:
    <?php

    public function serverStatus($ip,$port,$timeout 1)
    {
            try
            {
                
    $status fsockopen($ip,$port,$errno,$errstr,$timeout);
                if(!
    $status)
                {
                    return 
    "OFF";
                }
                else 
                {
                    return 
    "ON";
                }
            }
            catch(
    Exception $e)
            {
                      return 
    "OFF";
            }
    }  

    if(
    serverStatus(85.122.110.66,25565,60) == "ON")
    {
       echo 
    "Server is UP";
    }
    else
       echo 
    "Server is Down";  

    ?>
    Try that one..
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  9. #9
    P.o.X
    P.o.X is offline
    Member-in-training P.o.X's Avatar
    Join Date
    2012 May
    Posts
    64
    Thanks Thanks Given 
    11
    Thanks Thanks Received 
    11
    Thanked in
    7 Posts
    Rep Power
    0
    tryed and i get this:
    Parse error: syntax error, unexpected T_PUBLIC in /home/a2725571/public_html/status.php on line 3


  10. #10
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    Hahaha....sorry my mistake..
    that just a php file, so you cant use public modifier because public modifier just for make a function can be access public from a PHP class..

    so just delete public and done..
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

Page 1 of 2 12 LastLast

Similar Threads

  1. Getting Dragon Nest port and IP
    By wildspirit in forum Dragon Nest Bots, Hacks, Cheats
    Replies: 0
    Last Post: 2011-11-09, 05:14 AM
  2. [Release] MineCraft build collection, port, X-ray mod etc
    By Grooguz in forum MineCraft
    Replies: 0
    Last Post: 2011-09-24, 01:46 AM
  3. [Guide] Make Private Minecraft Server 1.7 with Hamachi (No port foward)
    By Grooguz in forum MineCraft Guides, Tutorials
    Replies: 0
    Last Post: 2011-08-20, 10:40 AM
  4. [Bug] MM Port Glitch
    By Dwar in forum CrossFire Glitches, Bugs
    Replies: 0
    Last Post: 2011-02-01, 12:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •