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?

Last edited by Aiden; 08/01/19 12:02 AM.