mIRC Home    About    Download    Register    News    Help

Print Thread
Help me about submiting Forms in socket! #79136 13/04/04 01:25 PM
Joined: Apr 2004
Posts: 11
A
AnhTraiSG Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
I wrote a script that can get infomation from my web site, and i want to submit a form to tranfer data to my site using method POST (like : login a forum with username and password)...
Can you help me?

Re: Help me about submiting Forms in socket! #79137 13/04/04 07:58 PM
Joined: Dec 2002
Posts: 1,922
O
Online Offline
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
See if this post helps. If not, you can make an expanded search over the board.

Re: Help me about submiting Forms in socket! #79138 14/04/04 01:07 AM
Joined: May 2003
Posts: 79
A
Artwerks Offline
Babel fish
Offline
Babel fish
A
Joined: May 2003
Posts: 79
If you speak French, I've written a tutorial on how to use cookies with mIRC scripting. The tutorial shows you how to login to scriptsdb.org while explaining the process. You can read it here.

Re: Help me about submiting Forms in socket! #79139 14/04/04 09:21 PM
Joined: Oct 2003
Posts: 101
root66 Offline
Vogon poet
Offline
Vogon poet
Joined: Oct 2003
Posts: 101
Sorry this is gonna paste so ugly. I really don't like $& though.

Code:
alias httpreq {
  var %p | if ($1 == -p) { %p = 1 | tokenize 32 $2- }
  sockwrite -n $1 $iif(%p == 1,POST,GET) $3 HTTP/1.1 $+ $crlf $+ Accept: */* $+ $crlf $+ User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) $+ $crlf $+ Host: $2 $+ $crlf $+ Connection: Keep-Alive $+ $iif($4,$crlf $+ Referer: $4) $+ $iif($5,$crlf $+ Cookie: $5) $+ $iif($6,$+($crlf,Content-Type: application/x-www-form-urlencoded,$crlf,Content-Length: $len($5),$crlf,$6))
  if (%p == $null) { sockwrite -n $1 }
}


The usage is as follows:

/httpreq [-p] <sockname> <host.com> </url.html> [referral-site] [cookie-data]

- Default uses http GET.
- The optional -p is the POST you want.
- Right now it only supports one cookie (name=value;). Maybe someone can improve upon it?




Thanks all! #79140 16/04/04 03:08 PM
Joined: Apr 2004
Posts: 11
A
AnhTraiSG Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
I will test your script and hope that it run ok. Thanks for your teaching.

Re: Help me about submiting Forms in socket! #79141 18/04/04 07:29 AM
Joined: Apr 2004
Posts: 11
A
AnhTraiSG Offline OP
Pikka bird
OP Offline
Pikka bird
A
Joined: Apr 2004
Posts: 11
I think you can write a script that can register a username for Invision Power Board (IBF). If you have a correct code can you share me? I'm learning about socket with sending data by POST method, but I have not a good sample... Thanks a lot for helping me.

Re: Help me about submiting Forms in socket! #79142 19/04/04 06:30 PM
Joined: Oct 2003
Posts: 101
root66 Offline
Vogon poet
Offline
Vogon poet
Joined: Oct 2003
Posts: 101
I just noticed a bug in that code. The $len should be $len($6) not $len($5). Sorry