mIRC Home    About    Download    Register    News    Help

Print Thread
Socket Help #207687 28/12/08 06:29 AM
Joined: Jul 2008
Posts: 10
E
Evil_Panda Offline OP
Pikka bird
OP Offline
Pikka bird
E
Joined: Jul 2008
Posts: 10
I'm trying to retrieve all the info from the first page after I log in to my game (Torn City) but can't get it to authenticate. Any help would be appreciated.

Code:
on *:text:!sockupdate:#:{ sockopen bag www.torncity.com 80 }

on *:SOCKOPEN:bag:{
  var %string = player=player&password=pass
  sockwrite -n $sockname POST /authenticate.php HTTP/1.1
  sockwrite -n $sockname Host: www.torncity.com
  sockwrite -n $sockname Referer: www.torncity.com/index.php
  sockwrite -n $sockname Content-Length: $len(%string)
  sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
  sockwrite -n $sockname Cookie: SERVERID=ww11; PHPSESSID=ubltva7cjuove678ogf5ljcif2; 
  sockwrite -n $sockname $crlf %string
}

on 1:sockread:bag:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  if (* iswm %temp) {
    echo -a -
    msg #ci $htmlfree(%temp)
    goto nextread
  }
}

alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

alias urlencode {
  var %a = $regsubex($$1,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2)))
  return $replace(%a,$chr(32),$chr(43))
}


EDIT - I removed my log in info and replaced with generic lol

Re: Socket Help [Re: Evil_Panda] #207700 28/12/08 02:27 PM
Joined: Dec 2005
Posts: 58
S
SCNDRL Offline
Babel fish
Offline
Babel fish
S
Joined: Dec 2005
Posts: 58
save cookie via Set-Cookie data. after that return homepage with cookie that you saved.


i like that