_Dean_ commented on a Page, HTTP status code checker  -  Feb 21, 2011

i need to test it into 6.35 so, and check if there is an error on it, so i will warn ppl about the version
i know that the same ppl as ever will score it with 1

try this edit

on $*:text:/^!checkstatus\s(\d+)$/iS:#:{
  checkstatus $regml(1) #
}
alias checkstatus {
  var %x = $+(status,$ticks,$nick)
  if ($sock(%x)) { return }
  else {
    sockopen %x www.askapache.com 80
    sockmark %x $1 $2
  }
}

on *:sockopen:status*: { 
  if ($sockerr) { $gettok($sock($sockname).mark,2,124) ERROR: $sock($sockname).wsmsg | return }
  else {
    var %x sockwrite -n $sockname
    %x GET /htaccess/apache-status-code-headers-errordocument.html HTTP/1.1
    %x HOST: www.askapache.com
    %x
  }
}

on *:sockread:status*: { 
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { $2 ERROR: $sock($sockname).wsmsg | return }
  else {
    var %x 
    sockread %x
    var %t = $regex(%x,/<a href="#status- $+ $1 $+ \b".+>Sample\s(.+)<\/a>\s<br \/>(.+)<\/dd>/)
    if (%t) {
      msg $2 $+(,$regml(1),) - $regsubex($regml(2),/<[^>]+>/g,)
      sockclose $sockname
    }
  }
  if (</table> isin %x) && (!%t) { 
    msg $2 The status code does not exist, or can not be found | sockclose $sockname
  }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.