|
-
Nov 14th, 2008, 03:36 PM
#1
Thread Starter
Fanatic Member
[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, $error, 5))
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?
-
Nov 14th, 2008, 03:54 PM
#2
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
-
Nov 14th, 2008, 04:01 PM
#3
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, $error, 5);
if($sock)
{
echo "<p style='color:green;'>Online</p>";
}
else
{
echo "<p style='color:red;'>Offline</p>";
fclose($sock);
}
?>
</body>
</html>
-
Nov 14th, 2008, 04:45 PM
#4
Thread Starter
Fanatic Member
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.
-
Nov 14th, 2008, 05:28 PM
#5
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.
-
Nov 14th, 2008, 05:36 PM
#6
Thread Starter
Fanatic Member
Re: Server status?
if html files are saved as .php then yes i do.
-
Nov 14th, 2008, 05:45 PM
#7
Re: Server status?
Where are you saving the php file then?
On a webhost, or your local machine?
-
Nov 14th, 2008, 06:11 PM
#8
Thread Starter
Fanatic Member
-
Nov 14th, 2008, 06:57 PM
#9
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?
-
Nov 14th, 2008, 07:03 PM
#10
Thread Starter
Fanatic Member
-
Nov 14th, 2008, 07:06 PM
#11
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
-
Nov 14th, 2008, 07:16 PM
#12
Thread Starter
Fanatic Member
Re: Server status?
what do i do when i installed that?
-
Nov 14th, 2008, 07:41 PM
#13
Re: Server status?
put your php script into the WWW directory, and go to http://localhost/yourpage.php
My usual boring signature: Something
-
Nov 14th, 2008, 07:44 PM
#14
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|