setRequestEntity
void scrapeableFile.setRequestEntity ( String requestEntity ) (professional and enterprise editions only)
Description
Set POST payload data. This is particularly helpful with scraping some site's implementation of AJAX, where the payload in explicitly set as xml.
Parameters
- requestEntity Desired content 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 setContentType as that method specifies the content of the POST data.
Though you can set plain text POST data using this method it is preferable to use the addHTTPParameter method for this task.
Examples
Set POST data as XML
// 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>" );
// 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>" );
scraper on 07/16/2010 at 4:56 pm
- Printer-friendly version
- Login or register to post comments