I've tried it this way, but mirc returns a 408 error request timeout.
alias Example {
/sockopen Example github.com 80
; Check if there was an error.
if ($sockerr) {
echo -ag There was an error: $sockerr
halt
}
}
; Listen for the on SOCKOPEN event.
on *:SOCKOPEN:Example:{
; Write a GET request.
sockwrite -nt $sockname GET / HTTP/1.1
; Check if there was an error.
if ($sockerr) {
echo -ag There was an error: $sockerr
halt
}
}
; Listen for the on SOCKREAD event.
on *:SOCKREAD:Example:{
; Check if there was an error.
if ($sockerr) {
echo -ag There was an error: $sockerr
halt
}
; Create a local variable to hold the data.
var %i
; Read the data waiting into the local variable.
sockread %i
; Print data read.
echo -ag Data = %i
%a = %i
}
Output from mirc:
Data = HTTP/1.1 408 Request Time-out
Data = Content-length: 110
Data = Cache-Control: no-cache
Data = Connection: close
Data = Content-Type: text/html
Data =
Data = <html><body><h1>408 Request Time-out</h1>
Data = Your browser didn't send a complete request in time.
Data = </body></html>
If I open github.com with my browser e.g. Firefox
then I don't get a 408 error so why with mirc?