makeHEADRequest
String[][] sutil.makeHEADRequest ( String url )
Description
Retrieve the response header contents.
Parameters
- url URL encoded version of page request, as a string. Java provides a URLEncoder to aid in URL encoding of a string.
Return Values
Returns contents of the response, as a two-dimensional array.
Change Log
Version | Description |
---|---|
5.0 | Added for all editions. |
This method will use any proxy settings that have been specified in the Settings dialog box..
Examples
Retrieve Page Contents
// Log HEAD contents
// Get head contents
headerArray = sutil.makeHEADRequest("http://www.screen-scraper.com/tutorial/basic_form.php?text_string=Hello+World");
// Loop through HEAD contents
for (int i=0; i<headerArray.length; i++)
{
// Write header to log
session.log(headerArray[i][0] + ": " + headerArray[i][1]);
}
/* Example Log:
Date: Fri, 04 Jun 2010 17:18:11 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
Connection: close
Content-Type: text/html; charset=UTF-8
*/
// Get head contents
headerArray = sutil.makeHEADRequest("http://www.screen-scraper.com/tutorial/basic_form.php?text_string=Hello+World");
// Loop through HEAD contents
for (int i=0; i<headerArray.length; i++)
{
// Write header to log
session.log(headerArray[i][0] + ": " + headerArray[i][1]);
}
/* Example Log:
Date: Fri, 04 Jun 2010 17:18:11 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
Connection: close
Content-Type: text/html; charset=UTF-8
*/
See Also
- getContentAsString() [scrapeableFile] - Retrieve contents of the response.
- getStatusCode() [scrapeableFile] -Determine the HTTP status code sent by the server.
scraper on 07/16/2010 at 5:21 pm
- Printer-friendly version
- Login or register to post comments