Jump to content
Sign in to follow this  
WhiteCrow

How to check if a http server is online ?

Recommended Posts

WhiteCrow

I have a http server running on 192.168.1.100 on port 18080

how can i check remotly from within the lan, if the website is still up ?

The page i want to check is account.htm

I wanted to use Wouters _InetGetSource, but that function doenst support port numbers.

And the _InetGetSource that comes with the latest beta doesnt even support, non exsistant pages :P

Any help would be apreciated ;)

Share this post


Link to post
Share on other sites
MSLx Fanboy

Just send a Get request via the TCP* functions

Dim $header
$header = "GET / HTTP/1.1" & @CRLF & _
"Host: www.w3c.org" & @CRLF & _
"Connection: close" & @CRLF & _
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*" & @CRLF & _
"Accept-Language: en-us" & @CRLF & _
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Web-Sniffer/1.0.22" & @CRLF & _
"Referer: http://web-sniffer.net/" & @CRLF & @CRLF

TCPStartup()
$socket = TCPConnect('192.168.1.100',18080)
TCPSend($socket, $header)
$return = TCPRecv($socket, 5000)
MsgBox(0, 'test', $return)

No guarantees, off the top of my head

Edit2: Used the web-sniffer.net services for this (as seen in Referer...)

Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites
WhiteCrow

You are right ;)

Must have been blind while looking at the Autoit-helpfile.. that i missed it.

The code is straightforward.

$server_IP = "192.168.1.100"
$server_http_port = "18080"

TCPStartUp()

$socket = TCPConnect( $server_IP, $server_http_port )
If $socket = -1 Then 
MsgBox(0, "", "Error")
else
MsgBox(0, "", $socket)
endif

Share this post


Link to post
Share on other sites
MSLx Fanboy

You can do that, but you can't guarantee that there is an HTTP server at the other end...

You can also use a com object (winhttprequest i believe)

Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×