mIRC Homepage

SOCKET ISSUE - MIRC

Posted By: Aiden

SOCKET ISSUE - MIRC - 07/01/19 11:58 PM

I'm trying to get contents of a page using socket.
Here is my code:
Code:
alias test {
  sockopen test decapi.me 80
}

on *:sockopen:test: {
  sockwrite -n $sockname get /twitch/followage/forsen/sodapoppin HTTP/1.0 
  sockwrite -n $sockname Host: decapi.me
  sockwrite -n $sockname
  
}

on *:sockread:test: {
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temp
    sockread %temp
    echo %temp
  }
}

on *:text:!test:#:{
  test
}


However this is the output that I get:
Quote:

HTTP/1.1 400 Bad Request
Server: nginx-rc
Date: Mon, 07 Jan 2019 23:57:25 GMT
Content-Type: text/html
Content-Length: 173
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.15.3</center>
</body>
</html>


Any idea how to fix this?
Posted By: FroggieDaFrog

Re: SOCKET ISSUE - MIRC - 08/01/19 12:02 AM

1: Capitalize GET
2: Its HTTP/1.1 not HTML/x.x
Posted By: Aiden

Re: SOCKET ISSUE - MIRC - 08/01/19 12:23 AM

Changing it from 1.0 to 1.1 fixed it. Thanks
© 2019 mIRC Discussion Forums