/    Sign up×
Community /Pin to ProfileBookmark

Hello,

i’m trying to send an echo to my router to is if its online i have it working for all the other web servers

server FTP Server OK
server MySQL Server OK
server POP Server OK
server SMTP Server OK
server Webserver OK
Home Router Down

the code i have used is. (i thought it would be port 80, i have a static ip so the router ip changing each time i reboot the router is not a issue.

<?

echo “<table align=”center” width=”400″ border=”0″ cellspacing=”0″ callpadding=”0″>”;
$servers = array(
“server FTP Server:whotookmyname.com:21” ,
“server MySQL Server:whotookmyname.com:3306” ,
“server POP Server:whotookmyname.com:110” ,
“server SMTP Server:whotookmyname.com:25” ,
“server Webserver:whotookmyname.com:80” ,
“Home Router:**.***.***.**:80″ ,

);
$working = 0;
$notworking = 0;
foreach($servers as $server){
$server = explode(“:”,$server);
$name = $server[0];
$host = $server[1];
$port = $server[2];
if(@$fp = fsockopen($host,$port,$errno,$errstr,1)){
echo ‘<tr><td bgcolor=”#DDFFE8″>’.$name.'</td><td
width=”50″ bgcolor=”#DDFFE8″ align=”center”><b>OK</b></td></tr>’;
$working ++;
fclose($fp);
}else{
echo ‘<tr><td bgcolor=”#FFDDDE”>’.$name.'</td><td
width=”50″ bgcolor=”#FFDDDE” align=”center”><b>Down</b></td></tr>’;
$notworking++;
}
}
</table
?>

Paul

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@themartySep 18.2006 — and your question is .... ?
Copy linkTweet thisAlerts:
@Pbrown23authorSep 18.2006 — if any one knows why Home Router is not working, is this due to the port? or a route setting
Copy linkTweet thisAlerts:
@themartySep 18.2006 — have you tried it without the @ ? and if so, what is the error message?
Copy linkTweet thisAlerts:
@Pbrown23authorSep 18.2006 — When i remove the @ i get the following message


Warning: fsockopen() [function.fsockopen]: unable to connect to **.***.***.***:80 in /home/whotook1/public_html/servers/index.php on line

21

The * are my ip which i have masked

Paul
Copy linkTweet thisAlerts:
@themartySep 19.2006 — well, if [b]server Webserver:whotookmyname.com:80[/b] worked and yours failed, then you're either not connecting to the right port, or your router just doesn't allow the connection. Are you trying to connect from a computer outside the local network? Try connecting with a normal web-browser (since you're connecting to port 80, i assume the router can display some can of configuration page?) from the same machine that the php has script running.
Copy linkTweet thisAlerts:
@bokehSep 19.2006 — Are you connecting to the router from externally or internally? Sounds like the router firewall is stopping the exchange or the port is not forwarded.
×

Success!

Help @Pbrown23 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...