OverloadUT Posted July 22, 2006 Share Posted July 22, 2006 (edited) I am working on a fairly large project and a big part of it is an AutoIt application that uploads a lot of data to a PHP script.For a while I was using INetGet and submitting all my data as GET variables in the URL. However, the amount of data to upload got too big (over 1000 characters) and the INetGet function started to fail.I also hated that INetGet ONLY works if the webserver responds with "200 OK" - There is no way to tell the difference between a 404 error and simply not being able to connect to the server in the first place.So I write this library of UDF's. Basically, it's a fully compliant HTTP/1.1 client. It uses only the TCP functions; no DllCall needed here! I had a blast learning all about the HTTP protocol and how to use it.Advantages over INetGet:The data is downloaded right in to variables instead of to files. You can of course then write this data to a file if you wish.You can read all of the headers supplied by the webserver.You can get the HTTP Response Code from the webserver.When it failes, you know exactly what failed instead of having to guess.; =================================================================== ; HTTP UDF's ; v0.5 ; ; By: Greg "Overload" Laabs ; Last Updated: 07-22-06 ; Tested with AutoIt Version 184.108.40.206 ; Extra requirements: Nothing! ; ; A set of functions that allow you to download webpages and submit ; POST requests. ; ; Main functions: ; _HTTPConnect - Connects to a webserver ; _HTTPGet - Submits a GET request to a webserver ; _HTTPPost - Submits a POST request to a webserver ; _HTTPRead - Reads the response from a webserver ; ===================================================================I consider this UDF package to be a "beta" and that's why I call it version 0.5. However, I would love people to give it a try and tell me how it works for them. I have done extensive testing and I think I have the parser working perfectly.I plan on improving this library. It's possible that I might change the way the functions work (I don't think the _HTTPConnect function is necessary; I could move that functionality right in to the Get or Post functions.)To Do:Add a function that downloads the data right to a file. You might not want to download a 10 meg file in to memory before saving it to a file.Add a method to get the progress of the download. This will probably be in the form of a callback function, if that's possible in AutoIt.Add the ability to automatically follow "Location:" headers. Currently you'd have to do it manually.Other things I can't think of!Post #25 For Updated functions to work with current AutoIt versions. Edited November 15, 2007 by SmOke_N Redirect to correct post for download NightHawk56 1 Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now