Code:
alias ip {
  sockopen whatismyip whatismyip.com 80
  echo socket opening
}
on *:sockopen:whatismyip: {
  echo socket opened  
  sockwrite -n $sockname GET / HTTP/1.0
  sockwrite -n $sockname Host: whatismyip.com $+ $crlf $+ $crlf
  echo socket written
}
on *:sockread:whatismyip: {
  echo socket reading
  echo checking for errors
  if ( $sockerr ) { echo -a Error while requesting IP: $sock($sockname).wmsg | halt }
  else {
    echo no errors, continuing
    var %temptext
    sockread %temptext
    echo var temptext: " $+ %temptext $+ "
    if ( <TITLE>Your ip is *.*.*.* WhatIsMyIP.com</TITLE> iswm %temptext ) {
      echo -a Your IP is: $htmlfree(%temptext)
    }
  }
  sockclose $sockname
  echo socket closed
}
alias htmlfree {
  echo filtering html
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, )
  return %x
}


Why is this code not working?
I created it following a tutorial, but it seems it doesn't work.
(I didn't literally follow the tutorial, I replaced some things to fit my needs)

I wanted to grab my ip from www.whatismyip.com and echo it to myself.

Thanks in advance!!!

I get this echoes:

Code:
socket opening
socket opened
socket written
socket reading
checking for errors
no errors, continuing
var temptext: "HTTP/1.1 200 OK"
socket closed