request

A request objects references a proxySession page request. Through this object you can control various aspects of the request.

Scripts run in the scraping engine use the scrapeable file to manipulate server requests.

addHTTPHeader

void request.addHTTPHeader ( String key, String value )

Description

Manually add an HTTP header.

Parameters

  • key Name of the HTTP header, as a string.
  • value Value to be associated with the header, as a string.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Add HTTP Header

 // Set Cookie header to someCookieValue
 request.addHTTPHeader( "Cookie" , "someCookieValue");

See Also

addPOSTParameter

void request.addPOSTParameter ( String key, String value )

Description

Add POST parameter to HTTP request.

Parameters

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

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Add POST Parameter

 // Add selectedState parameter to the POST variables
 // with a value of Alaska

 request.addPOSTParameter( "selectedState" , "AL");

See Also

getURLAsString

String request.getURLAsString ( String key )

Description

Retrieve the URL of the request.

Parameters

This method does not receive any parameters.

Return Values

Returns the URL of the request, as a string.

Change Log

Version Description
4.5 Available for all editions.

Examples

Retrieve Request URL

 // Retrieve the URL String
 url = request.getURLAsString();

removeHTTPHeader

void request.removeHTTPHeader ( String key, String value )

Description

Manually remove an HTTP header. Both the key and value have to be specified as HTTP headers allow for multiple headers with the same key.

Parameters

  • key Name of the HTTP header, as a string.
  • value Value to be associated with the header, as a string.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Remove HTTP Header

 // Remove the Cookie header with the value someCookieValue
 request.removeHTTPHeader( "Cookie" , "someCookieValue");

See Also

removePOSTParameter

void request.removePOSTParameter ( String key )

Description

Remove POST parameter from HTTP request.

Parameters

  • key Name of the POST parameter, as a string.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Remove POST Parameter

 // Removes the POST parameter selectedState
 request.removePOSTParameter( "selectedState" );

See Also

setRequestLine

void request.setRequestLine ( String requestMethod, String url, String httpVersion )

Description

Manually set the request line.

Parameters

  • requestMethod HTTP request type, as a string.
  • url Valid uri, as a string.
  • httpVersion HTTP version, as a string.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for all editions.

Examples

Set Request Line

 // Sets the request line on the request
 request.setRequestLine( "GET" , "http://somesite.com/somepage.html", "HTTP/1.1");