Try using this code but be careful for excess flood! in order to work this code the bot must be into the channel that the !test command executed.

Code:
on *:sockopen:test: {
  if ($sockerr) {
    var %m = $iif($me ison $sock($sockname).mark,msg $sock($sockname).mark,echo -a)
    %m Error, The was an connection error, try again later!
    sockclose $sockname
    return
  }
  sockwrite -n $sockname GET /index.php HTTP/1.0
  sockwrite -n $sockname User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
  sockwrite -n $sockname Host: host.com
  sockwrite -n $sockname Accept-Language: en-us
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname
}
on *:sockread:test: {
  if ($sockerr) {
    var %m = $iif($me ison $sock($sockname).mark,msg $sock($sockname).mark,echo -a)
    %m Error, The was an connection reading error, try again later!
    sockclose $sockname
    return
  }
  var %temp
  sockread -f %temp 
  if ($sockbr) {
    if ($me ison $sock($sockname).mark) { $iif($me ison $sock($sockname).mark,msg $sock($sockname).mark,echo -a) READ: %temp }
  }
}

on *:text:!test:#: {
  if ($sock(test)) { .msg $chan Error, Already in use, Please wait to finish! | return }
  sockopen test google.com 80
  sockmark test $chan
}


- Thanks!