setContentType

void scrapeableFile.setContentType ( String contentType ) (professional and enterprise editions only)

Description

Set POST payload type. This is particularly helpful with scraping some site's implementation of AJAX, where the payload in explicitly set as xml.

Parameters

  • setContentType Desired content type of the POST payload, as a string.

Return Values

Returns void.

Change Log

Version Description
4.5 Available for professional and enterprise editions.

This method must be called before the file is scraped.

This method is usually used in connection with setRequestEntity as that method specifies the content of the POST data.

Examples

Set Content Type for XML payload in AJAX

 // In script called "Before file is scraped"

 // Sets the type of the POST entity to XML.
 scrapeableFile.setContentType( "text/xml" );

 // Set content of POST data
 scrapeableFile.setRequestEntity( "<person><name>John Smith</name></person>" );

See Also