INX Generic HTTP Poster DLL
 

The INX Generic HTTP Poster DLL is a simple component that provides the ability to perform HTTP Posts to webpages. This is useful if you wish to communicate with Webpage applications from programmatic environments such as ASP or Visual Basic.

In standard HTML, input from a visitor is typically handled by means of an HTML Form which is posted to a server-side processing script. Forms consist of form elements which are given names and values. A typical form declaration might be as follows:

      <FORM METHOD=POST ACTION="addclient.asp">
      Client  : <INPUT TYPE=TEXT SIZE=20 NAME="ClientName">
      Address : <TEXTAREA NAME="Address" ROWS=3 COLS=30></TEXTAREA>
      Tel     : <INPUT TYPE=TEXT SIZE=15 NAME="Tel">
      Invoice : <INPUT TYPE=RADIO NAME="inv" VALUE=0>No <INPUT TYPE=RADIO NAME="inv" value=1>Yes
                <INPUT TYPE=SUBMIT VALUE="Send Form">
      </FORM>
    

The above form submits 4 form elements to the server side script addclient.asp when the form submit button is clicked. The element names are ClientName, Address, Tel and inv. The element values are whatever the user had entered into the form with the exception of the inv element. The inv element value will be either 0 or 1, depending on which radio button has been selected.

Now all of the above is old hat to web programmers. It is a basic construct that every web programmer knows off by heart. Web Application users are also very familiar with filling in such Web forms. Sometimes however, you want to post the form not from a browser and by a human, but from a piece of automated code. This is particulary useful when you are writing automated programs that have to interface to an existing web application. Such programs "fool" the Web Application into thinking that an HTML form was completed and submitted by a human with a webbrowser, while in reality, it was done from an automated program using the INX Generic HTTP Component to perform the HTTP Posting.

 
INX Generic HTTP Poster Properties & Methods
 
Public Sub AddParam(ByVal Name, ByVal Value) As StringAddParam (Name, Value)Method to add a form element to the Post Component. Requires the parameter name and its value.
Function Post(URL, [ByVal URLEncode As Integer = 1]) As StringPost (URL,[URLEncode=1])Intructs the component to post the previously added form elements to the give URL. The optional URLEncode value can be passed to indicate whether or not the component should URLEncode the items added earlier. The Method returns a string which details any errors that the component may have encountered, or a zero length string if no errors occurred.
Property LastResponse As String (read-only)LastResponseRead-only method that returns the webserver response to the previous message. Only makes sense after invoking the Post method.
Property SleepDelay As LongSleepDelayThis property controls the time (in ms) that the component is put to sleep for while waiting for a webserver response. It affects the component's load on the webserver, but should generally be left alone.
 
Sample ASP code for the component
 
<%
cURL = "http://mysite.com/addclient.asp"

Set X = Server.CreateObject("INXHTTPPost.Poster")
X.AddParam "Client", "Mr Joe Soap"
X.AddParam "Address", "39 24th Street" & vbcrlf & "Johannesburg" & vbcrlf & "South Africa"
X.AddParam "Tel", "+27-11-555-5555"
X.AddParam "inv","0"
E = X.Post(cURL)
If Len(E) > 0 Then
  Response.Write "Oops, an error occurred : " & E
Else
  Response.Write "The Post was successfully done. The Response from the Webserver was :<BR>"
  Response.Write X.LastResponse
End If
Set X = Nothing
%>
 
Downloads
 
Complete Installation (Zip file)1,476,205 bytes
INX HTTPPost DLL Only (Requires that you already have VB6 SP5 runtimes and MSINET.OCX V6 SP5 and know how to use regsvr32.exe)40,960 bytes
 
Revision History
 
7 Dec 2002Updated Release V1.0.3 adding LastResponse property.
28 Sep 2002Initial Release V1.0.0
 
Build & Resource Information
 
Primary Build Tool Visual Basic 6.0 SP5
 
Disclaimer
 

This Component is provided as is and without any guarantees or promises. You use it entirely at your own risk. It was written with care and was not designed to do anything clandestine or trojan like. However, it cannot be assumed to be bug or error free. You also cannot hold me responsible if it crashes your machine, corrupts your registry, destroys your Micosoft Visual Studio 6.0 SP5 (which it was built with) or starts World War III. Since it's free, I do not guarantee performance, support or error-free operation.

 
Contact Information
 

This Webpage was written in a great hurry, so please don't judge the control on the appearance of this page. One day when I grow up, I'll make a decent page. If you wish to mail me any comments, feel free to do so at stefan@internext.co.za

 
accesses since 28 September 2002