addHTTPHeader

void scrapeableFile.addHTTPHeader ( String key, String value ) (professional and enterprise editions only)

Description

Add an HTTP header to be sent along with the request.

Parameters

  • key Name of the variable, as a string.
  • value Value of the variable, as a string

Return Values

Returns void. If you are not using enterprise edition it will throw an error.

Change Log

Version Description
5.0 Available for professional and enterprise edition.
4.5 Available for enterprise edition.

In certain rare cases it may be necessary to explicitly add a custom header of the POST data of an HTTP request. This may be required in cases where a site is using AJAX, and the POST payload of a request is sent as XML (e.g., using the setRequestEntity method). This method must be invoked before the HTTP request is made (e.g., "Before file is scraped" for a scrapeable file).

Examples

Add AJAX header

 // In a script called "Before file is scraped"

 // Add and set AJAX-Method header to true.
 scrapeableFile.addHTTPHeader( "AJAX-Method", "true" );

See Also