Mallinanga Posted March 25, 2003 Share Posted March 25, 2003 hi there... well here is the thing... is there a way to automatically ping or sth my ftp server from my page every x mins and if it gets some response to indicate that the server is online or offline??? please if someone has seen sth like let me know...it would be great! thanks in advance Link to comment Share on other sites More sharing options...
0 pringlex Posted March 25, 2003 Share Posted March 25, 2003 (edited) Yeah, give this a go: (modify the host and port accordingly) <?php $ftplink = @ftp_connect("localhost", 21, 3); if ($ftplink == False) { // Header("Content-Type: image/png"); // readfile("./offline.png"); print "Offline"; } else { ftp_close($ftplink); // Header("Content-Type: image/png"); // readfile("./online.png"); print "Online"; } ?> It'll just print the status as text, but uncomment the commented lines to make it display an image instead (you'll have to make the images though ;)) Edited March 25, 2003 by pringlex Link to comment Share on other sites More sharing options...
0 Mallinanga Posted March 26, 2003 Author Share Posted March 26, 2003 pringlex thank you!!! this works like a harm...!!! :) :) Link to comment Share on other sites More sharing options...
0 sukamusiru Posted March 26, 2003 Share Posted March 26, 2003 pringlex thank you!!!this works like a harm...!!! :) :) don't ya just love that? :happy: Link to comment Share on other sites More sharing options...
0 Premgenius Posted March 26, 2003 Share Posted March 26, 2003 so where exactly do you place this code? Link to comment Share on other sites More sharing options...
0 Tim Dorr Veteran Posted March 26, 2003 Veteran Share Posted March 26, 2003 In a php file on a webserver... Link to comment Share on other sites More sharing options...
0 pringlex Posted March 26, 2003 Share Posted March 26, 2003 No problem, glad I could help! :) Link to comment Share on other sites More sharing options...
Question
Mallinanga
hi there...
well here is the thing...
is there a way to automatically ping or sth my ftp server from my page every x mins and if it gets some response to indicate that the server is online or offline???
please if someone has seen sth like let me know...it would be great!
thanks in advance
Link to comment
Share on other sites
6 answers to this question
Recommended Posts