Hello. I am trying to create script, for when someone or myself types ".ttr-site" in the channel, it will check if www.toontownrewritten.com is online using www.downforeveryoneorjustme.com website.

The code displaying the websites results is no problem. Problem is, downforeverone...etc wont check www.toontownrewrriten.com itself to see if it actually displays errors even though its still online.

I'm trying to make it so once the results of downforevery..etc website say that the websites up, I then process a second socket to go to the actual website, being www.toontownrewritten.com

I am able to get there through my socket, but not what I am looking for:

Code:
HTTP/1.1 400 Bad Request
Server: cloudflare-nginx
Date: Sat, 07 Jun 2014 16:17:57 GMT
Content-Type: text/html
Content-Length: 177
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare-nginx</center>
</body>
</html>


As you can see, it goes to the site, but since it is a HTTPS:// or SSL website, it keeps giving be a "400 Bad Request" error, instead of what it should display which is the coding of this error page:



I have OpenSSL installed on mIRC, and enabled, and accepted teh site, so I'm not sure what the issue is

I basically just need to connect properly with the doublecheck socket since its HTTPS

Below is my complete coding:

Code:
;if someone types ".trr-site" in #toontownwritten channel, and the script isn't already active, set the nick who said the command,
;and execute the website check

on *:TEXT:*:*:{ 
  if ($chan == #toontownrewritten) { 
    if ($1 == .ttr-site || $2 == .ttr-site) { 
      if (!%active) { 
        set %active $nick
        check 
      } 
    } 
  } 
}

;if I type ".trr-site" in #toontownwritten channel, and the script isn't already active, set me as the nick, and execute the website ;check

on *:INPUT:#toontownrewritten:{ 
  if ($1 == .ttr-site) { 
    if (!%active) {
      set %active $me
      check
    } 
  } 
}

;Starts the website check process for www.downforeveryoneorjustme.com, a website that checks if the website is online or offline
;with a simple input.  I am marking www.toontownrewritten.com as the website to check

alias check {
  doublecheck
  if ($sock(sitecheck)) { sockclose sitecheck }
  sockopen sitecheck www.downforeveryoneorjustme.com 80
  sockmark sitecheck toontownrewritten.com
}

;Opens the website check process and inputs www.toontownrewritten.com it into www.downforeveryoneorjustme.com to check if its online or offline.

on *:sockopen:sitecheck: {
  sockwrite -n $sockname GET $+(/,$sock(sitecheck).mark) HTTP/1.1
  sockwrite -n $sockname Host: www.downforeveryoneorjustme.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}

;Once www.downforeveryoneorjustme.com is open, grab the HTML coding, read it, and just display the results of the website,
;stripping ;the HTML from the results as well.

on *:sockread:sitecheck: {
  ;Read the Socket
  var %x | sockread %x

  ;Strip the Sockets HTML and just display the website online/offline results 

  if ($regex(%x,(.+)<a href="(.+)"\sclass="domain">.+<\/a>(.+))) {

    ;If the www.downforeveryoneorjustme.com says the website is up,

    if (up isin %x) { 

      ;then lets initiate our doublecheck, but searching the toontownrewritten.com itself for any error messages from their server

      doublecheck {

        ;if the website displays error messages on it,

        if (%doublecheck == down) {

          ;In 2 seconds, we will start unsetting the doublecheck process and the nick, so I wont get spam commands and so the process can restart

          .timer 1 2 unset %active
          .timer 1 2 unset %doublecheck

          ;Message #toontownrewritten channel, displaying the nick who said the command, and saying the status of the website,
          ;stripping the http:// part, and simply showing the website and the status.  Since doublecheck == down, this will say the websites down.

          msg #toontownrewritten  $+ %active $+ : $gettok($replace($regsubex($+($regml(1), $regml(2), $regml(3)), /(<[^>]*>)/g,), http:&#x2F;&#x2F;, ), 2, 46)) $+ .com looks down from here.
        }

        ;If the website is truely up, then display the actual status from www.downforeveryoneorjustme and unset the variables in 2 seocnds
        ;to prevent spam, and restart the process.

        else {
          .timer 1 2 unset %active
          .timer 1 2 unset %doublecheck
          msg #toontownrewritten  $+ %active $+ : $deltok($replace($regsubex($+($regml(1), $regml(2), $regml(3)), /(<[^>]*>)/g,), http:&#x2F;&#x2F;, ), 1 ,46)) $+ .
        }
      }
    }
  }
}

;Intiate the doublecheck process for toontownrewritten.com.  If this socket is still open, lets close it.
;This is a "HTTPS://" ;website vice "HTTP://" so we have to go into SSL mode with the "-e" on sockopen and the websites port of 443.

alias doublecheck {
  if ($sock(doublecheck)) { sockclose doublecheck }
  sockopen -e doublecheck toontownrewritten.com 443
  sockmark doublecheck toontownrewritten.com
}

;Opening of toontownwritten.com - Can't figure out the website coding they use, I've tried index.php, index.html, index.htm,
;index.asp, index.aspx, with no luck so I just directed the website to /news/ folder, which is the default folder anyway.

on *:sockopen:doublecheck: {
  sockwrite -n $sockname GET /news/ HTTPS/1.0
  sockwrite -n $sockname Host: www.toontownrewritten.com
  sockwrite -n $sockname Connection: closed
  sockwrite -n $sockname $crlf
}

;Once the website is actually open, read the socket.  Don't need to strip it, but just search if the words *application error*
;are displayed on the page, since this is what shows up when the website is online, but with errors.  If it does display,
;set doublecheck as down, and continue with the sitecheck socket from www.downforeveryoneorjustme.com website.

on *:sockread:doublecheck: { 
  var %y 
  sockread %y
  if (*application error* iswm %y) {
    set %doublecheck down
  }
}