Home
Home Products Downloads Knowledge Base Links And Awards Contact Us
abspdf.com::Knowledge Base
Knowledge Base
  absolutePDF
    FAQ
    Manuals
      absPDF-Creator Easy
      absPDF-Spool Base
      absPDF-Spool CMD
      absTools-HTTP
      absTools-SendMail
      absTools-SendMail CMD
    Samples
      absPDF-Creator Easy
      absTools-HTTP
      absTools-SendMail

Introduction

absoluteTools - HTTP is a Com Activex Object created to let developers simulate interaction with web pages from Windows-based applications, using any Com-aware programming language, like Visual Basic, Visual C++  or Delphi. The usage is very simple as show by the supplied VB example project.
This control supports both HTTP and HTTPS protocols and is very suitable to create web spiders, automation tools and secure file transfer utilities.

The trial version downloaded from the website http://www.abspdf.com is fully functional with a limit of 60-days of free evaluation. To use the control beyond the 60-days trial period just register the object by providing a valid license code.

To obtain a license code visit http://www.abspdf.com.



Top ]


Getting started

Register the control

First you need to register the control. Open a "Command Prompt" window, go to the folder where you unpacked the files and type:
regsvr32   absTools-HTTP.dll

To use the control in Visual Basic

Create a new project. See Demo.vbp as an example.

  1. From menu: Project ->  References...
    Check 'absTools - HTTP'

  2. Create object:
    Dim objMyControl As Object
    Dim TmpContent As String
    Set objMyControl = CreateObject("absTools-HTTP")

  3. Unlock the control (if you have a valid key, otherwise just skip to the next item):
    retVal = objMyControl.Unlock("Name", "MyCompany", "unlock_key")

  4. Init the control with the timeout, user-agent string, cookie support activation, external cookie file, no proxy (enter empty values for defaults):
    retVal = objMyControl.Init("200", "", "", "", "", "", "", "")

  5. Add a GET text field:
    retVal = objMyControl.GETAddTextField("q", "absolutePDF")

  6. Send request with current field list to the specified URL:
    retVal = objMyControl.SendRequest("http//www.google.com/search", "", "GET", "")

  7. Use the response as you prefer (in this example we save it to a file):
    TmpContent = objMyControl.ResponseContent()
    TempFileName = ".\test.html"
    filenum = FreeFile
    Open TempFileName For Binary Access Write As #filenum
    Put #filenum, , TmpContent
    Close #filenum
For each step you can test retVal to see if there was an error: if retVal is empty the action succeeded (save for ResponseContent(), see Usage for more information), otherwise you get a text string representing the error (see later for details).



Top ]


Usage

Library absTools - HTTP
       
absTools-HTTP

Methods

Function ClearFields() As String
Clear fields list.
Returns:
- <empty string>: ok

Function Close() As String
Close the session, saving cookies if an external cookie file was specified.
Returns:
- <empty string>: ok

Function Decode64(pathname_fileout As String, encoded_string As String) As String
Decode the encoded_string and save it to pathname_fileout.
Returns:
- <empty string>: ok

Function GETAddTextField(field_name As String, field_value As String) As String
Add text field to the field list for a GET operation.
Returns:
- <empty string>: ok
- "ERROR_FIELDNAME_EMPTY": fieldname cannot be empty

Function Init(timeout As String, user-agent As String, activate_cookies As String, cookie_file as String, proxy_server As String, proxy_port As String, proxy_user As String, proxy_pass As String) As String
Use this method first to set the timeout, user-agent string, cookie support and in case external cookie save file (only permanent cookies are saved, temporary ones are stored internally only for the duration of the session with the control). Leave blank ("") any field for default values (120 sec., Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0), cookie support off). To enable using a proxy server fill in proxy_server and proxy_port, if the proxy server requires basic authentication please set also proxy_user and proxy_pass
Returns:
- <empty string>: ok

Function POSTAddFileField(file_field_name As String, file_pathname As String) As String
Add file field to the field list for a POST operation.
Returns:
- <empty string>: ok
- "ERROR_FIELDNAME_EMPTY": fieldname cannot be empty
- "ERROR_INVALID_FILE": the specified file doesn't exist or is not readable

Function POSTAddTextField(field_name As String, field_value As String) As String
Add text field to the field list for a POST operation.
Returns:
- <empty string>: ok
- "ERROR_FIELDNAME_EMPTY": fieldname cannot be empty

Function RequestRaw() As String
Read current request as a raw string (with headers). Useful for debugging.
Returns:
- the raw request

Function ResponseBaseURI() As String
Read current response base URI (can be different from request from redirections).
Returns:
- current response base URI

Function ResponseCode() As String
Read current response code.
Returns:
- current response code

Function ResponseContent() As String
Read current response content.
Returns:
- current response content

Function ResponseMessage() As String
Read current response message.
Returns:
- current response message

Function ResponseRaw() As String
Read current response as a raw string (with headers).
Returns:
- current raw response

Function SendRequest(url As String, referer As String, type As String, content-type As String) As String
Send request with the current field list (type can ge GET or POST, referer simulates coming from another webpage, content-type can be set "form-data" as opposed to the default type for the type specified: not applicable for GET requests, "application/x-www-form-urlencoded" for POST requests without file fields, "form-data" for POST requests with file fields).
The URL parameter must be in the form "http://xxxxxx" or "https://xxxxxx". No other protocols are supported at the moment. To specify a different port use the form "http://www.mysite.com:1000" (for port 1000, for instance).
To manage basic authentication use the form "http://username:password@www.mysite.com".
Returns:
- "RESPONSE_SUCCESS": the request received a response of success
- "RESPONSE_INFO": the request received a response of informational content (use ResponseRaw() method to get more information)
- "RESPONSE_REDIRECT": the request received a response of redirect (for POST requests, since GET requests get automatically redirected)
- "RESPONSE_ERROR": the request received a response of error (use ResponseCode() and ResponseMessage() for more information)
- "ERROR_EMPTY_URL": the url specified cannot be empty
- "ERROR_UNSUPPORTED_PROTOCOL": only http:// and https:// are allowed
- "ERROR_EMPTY_POST_FIELDS": for a POST request you need to specify at leat one text or file field
- "ERROR_EXPIRED_EVALUATION": the evaluation 60-days period is over, please register the control to continue using it

Function SetRequestBody(request_body As String) As String
Set body for current request (for custom applications like SOAP).
Returns:
- <empty string>: ok

Function Unlock(username As String, company As String, key As String) As String
Unlock the module with a valid key, see http://www.abspdf.com for information.
Returns:
- <empty string>: ok
- "ERROR_INCORRECT_KEY": the key isn't invalid or doesn't match the version or the information supplied
- "ERROR_EXPIRED_EVALUATION": the evaluation 60-days period is over, please register the control to continue using it
- "ERROR_UNREGISTERED_VERSION": the control is being used in free trial mode
- "ERROR_TOO_MANY_KEY_GUESSES": a wrong activation code has been supplied too many times, please try again after 24 hours


Top ]


Copyright

absoluteTools - HTTP is a Copyright 2004-2005 the absolutePDF Team

All rights reserved.

The software is given "as is". No responsibility shall be assumed by the authors for loss or damage, whether real or consequential, arising from its use. By using the software you explicitly agree to hold the authors blameless for any such losses or damages.

Please visit http://www.abspdf.com for more information.



Top ]