Sign in to follow this  
Followers 0
pingpong24

sending data via TCP to webserver plus user agent

4 posts in this topic

Hi,

I want to open a TCPconnection and SEND using GET method to a webserver, say

www.autoitscript.com/forum/index.php?act=" my verable goes here "

using a custmized UserAgent.

i.e.

TCP open connection to www.autoitscript.com

define useragent = "what ever i want to call my user agent") ; this bit is added to the GET request.. so the webserver knows what is sending the data.

Send (www.autoitscript.com/forum/index.php?act= "something" & name = "something else")

Stop TCP connection.

thats all i want to do.

I dont know how to code it, not the data sending part but the user agent part.. please someone help me.

many thanks. :P

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I want to open a TCPconnection and SEND using GET method to a webserver, say

www.autoitscript.com/forum/index.php?act=" my verable goes here "

using a custmized UserAgent.

i.e.

TCP open connection to www.autoitscript.com

define useragent = "what ever i want to call my user agent") ; this bit is added to the GET request.. so the webserver knows what is sending the data.

Send (www.autoitscript.com/forum/index.php?act= "something" & name = "something else")

Stop TCP connection.

thats all i want to do.

I dont know how to code it, not the data sending part but the user agent part.. please someone help me.

many thanks. :P

actualy the user agent part is simple because its text

when you receive data its more work to handle that

headers could look like this

$sendvar = "GET /test.html?" & $inputvar &  " HTTP/1.0" & @CRLF & "Accept: Image/JPEG" & @CRLF & "User-Agent: Mozilla 4.0(sucking candy)" & @CRLF & @CRLF

Would work as a header to get test.html

Keep in mind not to forget the two CRLFs at the end this is a message to the server like end of header

the server also returns a header but other data also two CRLFs at the end and then sends file (also with binary files)

Something like this

HTTP/1.1 200 OK

Content-Type: image/gif

Last-Modified: Mon, 25 Apr 2005 21:09:04 GMT

Expires: Sun, 17 Jan 2038 19:14:07 GMT

Server: GWS/2.1

Content-Length: 9040

Date: Fri, 30 Sep 2005 23:18:55 GMT

will be returned (i won't post the file data here because it was a gif)

See the empty line wich means there are two CRLFs at the end of the header (and one per header item in between)

Edited by MrSpacely

Share this post


Link to post
Share on other sites

:P

Things like this make me joyfull

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0