mIRC Homepage
Posted By: S0RD3N Sockets: Using POSTDATA - 14/11/04 02:54 AM
Hallo..
I'm trying to send POSTDATA to this webpage. I don't know how/what you're suppose to send when using /sockwrite. Could someone lead me in the right direction?

Thanks in advance! smile
Posted By: Coolkill Re: Sockets: Using POSTDATA - 14/11/04 08:27 AM
If your refering to HTTP POST, the following is its syntax.

POST [color:red]/dir/page.ext
HTTP/1.1
Referer: http://www.website.net/dir/page.php
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Host: www.website.net
Content-Length: length of your data
Connection: Keep-Alive
/sockwrite -n sockname
your data
/sockwrite -n sockname
[/color]
You should change to red to the following:

/dir/page.ext - should obviously be the page your trying to send the post data to, if your unsure of the page, goto the website with the 'form' your trying to fill in, and it will be located in the source code (IE, View - Source) here:

<FORM method="post" action="[color:red]HERE">[/color]

If just 'method=post' is there, then the page you should have in your POST / - will be the same page as the form is on.

http://www.website.net/dir/page.php - for the 'REFERER' again should be the page the form is on, you can usually get away without it, but it all depends on the website.

www.website.net is the websites domain name only, i.e. www.mirc.com

length of your data - is the length of your data further down this header, simply use $len() to get it. (obviously before you send the header you will need to set your data to a variable then send the length of the variable here, and further down send your variable.

/sockwrite -n sockname - is where in your coding you should perform this command, in the first instance it will seperate your data from the HTTP header, in the second instance will tell the server the end of your data.

your data the data you wish to send to the server, or the variable containing your data..

Hope this helps.

Eamonn.
Posted By: S0RD3N Re: Sockets: Using POSTDATA - 14/11/04 04:29 PM
Okay.. So what will I send for the post if I have 2 fields to send.. I have an editbox to send for and a drop down box to send for..
Posted By: Coolkill Re: Sockets: Using POSTDATA - 14/11/04 09:21 PM
your data would be something, similiar to:

var %data = username=Coolkill&password=testing123&ect

so, then you use $len(%data) for the content-length and where your data is, use %data.

To know what to send, view the source (as shown above) and all the data between the <FORM> and </FORM> html tags, such as editboxes, hidden tags will all be in your data, i.e.

<FORM>
<input type="hidden" name="page" value="loginpage">
<input type="text" name="username">
<input type="password" name="password">
</FORM>

would result in, data being: page=loginpage&username=[color:red]username&password=password[/color]

Where the red would be replaced by the users input obviously, if you get stuck paste the url for the page your trying to POST for.

Eamonn.
Posted By: S0RD3N Re: Sockets: Using POSTDATA - 15/11/04 01:52 AM
Thanks heaps! smile
© mIRC Discussion Forums