Basic socket script:

Code:
alias test {
  sockopen test somesite.com 80
}

on *:sockopen:test: {
  sockwrite -n $sockname get /remainder_of_url.html 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: your.host.com
  sockwrite -n $sockname Accept-Language: en-us
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname
}

on *:sockread:test: {
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temp
    sockread %temp
    if (something isin %temp) {
      do something
    }
    elseif (somethingelse isin %temp) {
      do something else
    }
  }
}


Take that and change the domain and URL and change the parsing (the IF/ELSEIF part) to what you need.

So...

Code:
alias test {
  sockopen test d3sanc.com 80
}

on *:sockopen:test: {
  sockwrite -n $sockname GET /db/manabot/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: d3sanc.com
  sockwrite -n $sockname Accept-Language: en-us
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname
}

on *:sockread:test: {
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %temp
    sockread -f %temp
    if (test isin %temp) {
      echo -a %temp
    }
  }
}


As you can see, I just change the host name in 2 spots, put in the correct path/page from the URL, and changed the parsing.

The -f in /sockread is necessary because you don't have a $crlf at the end of the line on your page. Also, the parsing is there because without it, you'll get all of the HTTP feedback, which you don't really want. Try it without the parsing (just echo %temp) and you'll see what I mean. Obviously you don't want to hard code the text into the IF, so you'll need something to tell it what to echo/use. If you're including scripting (HTML/PHP), you can use that to determine what line to display -- if (<something>* iswm %temp) { do this } -- for example. You could also just use the sockclose event if you always want the very last line read into the %temp variable.

Note that this is just basic. You'd normally have some more in the script, but this should get you started.

Last edited by Riamus2; 16/12/12 03:47 PM.

Invision Support
#Invision on irc.irchighway.net