Dss.Lexius Posted June 12, 2010 Share Posted June 12, 2010 hi, how do i get online or offline status of a server? Like we use Ping on our computer. Thanx Link to comment https://forums.phpfreaks.com/topic/204556-get-status-of-a-server/ Share on other sites More sharing options...
Dss.Lexius Posted June 12, 2010 Author Share Posted June 12, 2010 Guys i am new to PHP, but i know another language. in that language this code 'll do what i want: $var = Ping("www.google.com", 250) If $var Or @error = 0 Then Msgbox(0,"Status","Online, roundtrip was:" & $var) Else Msgbox(0,"Status","Offline, An error occured with number: " & @error) EndIf But i don't know how to do it in PHP. Anyone plz help with this, Thanx Link to comment https://forums.phpfreaks.com/topic/204556-get-status-of-a-server/#findComment-1071236 Share on other sites More sharing options...
Alex Posted June 12, 2010 Share Posted June 12, 2010 You can use fsockopen. $fp = fsockopen('www.google.com', 80, $errno, $errstr, 5); echo $fp ? "Online!" : "Offline!"; Link to comment https://forums.phpfreaks.com/topic/204556-get-status-of-a-server/#findComment-1071272 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.