Results 1 to 14 of 14

Thread: [RESOLVED] Server status?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] Server status?

    ok i got this code:

    PHP Code:
    <html>
    <head>
    <title> PHP Test Script </title>
    </head>
    <body>

    <?php 
    $ip 
    "(wont show)"
    $port "(wont show)"
    if (! 
    $sock = @fsockopen($ip$port$num$error5)) 
    echo 
    '<B><FONT COLOR=red>Offline</b></FONT>'

    else{ 
    echo 
    '<B><FONT COLOR=lime>Online</b></FONT>'
    fclose($sock); 

    ?>

    </body>
    </html>


    somehow when i try it, it doesnt do what its supposed to do, it shows this:

    PHP Code:
    Offline'; else{ echo 'Online'; fclose($sock); } ?> 

    how can i fix?

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Server status?

    What kind of server are you attempting to check?

    If it is a gaming server, you may need to specify udp in the ip.

    E.g) 127.0.0.1 would be udp://127.0.0.1

  3. #3
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Server status?

    PHP Code:
    <html> 
    <head> 
    <title> PHP Test Script </title>
    </head>
    <body> 

    <?php 
    $ip 
    "(wont show)"
    $port "(wont show)"

    $sock = @fsockopen($ip$port$num$error5);

    if(
    $sock)
    {
      echo 
    "<p style='color:green;'>Online</p>"
    }
    else

      echo 
    "<p style='color:red;'>Offline</p>"
      
    fclose($sock); 
    }
    ?> 

    </body> 
    </html>
    Chris

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    the182guy, now i get:

    Code:
    Online
    
    "; } else { echo "
    
    Offline
    "; fclose($sock); } ?> Offline'; else{ echo 'Online'; fclose($sock); } ?>

    and yes, its a gaming.

  5. #5
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Server status?

    I suspect you are saving the code in a HTML file.

    You're going to need to save it in a .php file to work normally.
    Chris

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    if html files are saved as .php then yes i do.

  7. #7
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Server status?

    Where are you saving the php file then?

    On a webhost, or your local machine?
    Chris

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    on my computer...

  9. #9
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Server status?

    Have you installed PHP on your machine?

    Have you installed the Apache web server?

    Also, are you placing the file in the public html/htdocs?
    Chris

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    where do i get that?

  11. #11
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Server status?

    There is a link in my signature that explains how to install a WAMP server.


    edit:
    or you could just install WAMP Server... but the first method is preferred.
    My usual boring signature: Something

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    what do i do when i installed that?

  13. #13
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Server status?

    put your php script into the WWW directory, and go to http://localhost/yourpage.php
    My usual boring signature: Something

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Server status?

    blank?

    changed the yourpage to the name and its blank.

    nevemind it works thanks everyone.
    Last edited by Justa Lol; Nov 14th, 2008 at 07:55 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width