Jump to content

HTTP POST / GET / HEAD


59FIFTY
 Share

Recommended Posts

Im new to Autoit and its functions. I was trying to connect to a regular HTTP WebServer over TCPConnect, but I just cant figure out how to do it. I know there's a UDF for INet but the function _INetGetSource can only gather informations from a Server, and not send them (viceversa)

Is there an easy way so set up a socket connection?

TCPStartup()
Dim $url = "www.msn.com"
Dim $port = 80
Dim $serverIp = TCPNameToIP($url)

$fsocket = TCPConnect($serverIp,$port)
TCPSend($fsocket, $HTTP_POST_HEADER)
$recv = TCPRecv($fsocket, 4096)
TCPCloseSocket($fsocket)

PS: This forum has a beautyfull them :P

Link to comment
Share on other sites

Theres a HTTP Post/Get UDF around here somewher xD

Yes, I am sure there are many! just search it up, you`ll find plenty of stuff. Sorry I cannot help, I really suck with TCP udfs

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

an http request chould look like this:

GET /dir/file.ext HTTP/1.1 @CRLF

Host: www.something.com@CRLF

From: email@address.com @CRLF

User-Agent: ProgramName/1.0 @CRLF

Connection: Close

@CRLF

change the stuff in italics to meet your needs. and be sure to include ALL the @CRLF's, or it won't work right. And be sure to keep the Host line and the Connection line, but the From and User-Agent lines can be removed if you want.

and here is what you should recieve in response:

100 Continue @CRLF

(STATUS CODE) (STATUS DESCRIPTION) HTTP/1.x @CRLF

header: something @CRLF

anotherHeader: more something @CRLF

(there could be any amount of headers here) @CRLF

@CRLF

(BODY OF PAGE)

oh, and when you recieve, there will be a status code. Here is a list of the codes (numbers) and the descriptions (words)

200 OK

(successful)

404 Not Found

(the requested file doesn't exist)

301 Moved Permanently

(the requested page has moved permanently to the url in the Location header)

302 Moved Temporarily

(the requested page has moved temporarily to the url in the Location header)

303 See Other

(The resource has moved to another URL (given by the Location: response header), and should be automatically retrieved by the client. This is often used by a CGI script to redirect the browser to an existing file.)

500 Server Error

(An unexpected server error. The most common cause is a server-side script that has bad syntax, fails, or otherwise can't run correctly.)

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

@theguy0000

I know how a HTTP POST GET HEAD works, but thanks anyway. I have problem with Autoit not with w3c HTTP

Here: HTTP UDF

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...