Unit simpleinternet
Description
This unit contains a very simple procedural interface to make http requests and process the returned data.
To get started, you can just use the function retrieve('...url...') to get the data you need as a string.
Retrieve also supports file:// urls or other data source; if you want to restrict it to http GET/POST-requests only, you can use the httpRequest function.
The data can then be processed with process which applies an XPath/XQuery expression or a html template to it.
Example
Get all links on a page:
for v in process('http://www.freepascal.org', '//a') do writeln(v.toString, ' => ', v.toNode['href']);
Overview
Functions and Procedures
function retrieve(data: string): string; |
function httpRequest(url: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
function httpRequest(url: string; rawpostdata: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
function httpRequest(url: string; postdata: TStringList): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
function httpRequest(const method, url, rawdata: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
function httpRequest(const destination: xquery.IXQValue): string; overload; deprecated 'Use destination.retrieve() instead.'; |
function process(data: string; query: string): xquery.IXQValue; |
function processedTree: TTreeNode; |
function processedVariables: TXQVariableChangeLog; |
procedure freeThreadVars; |
function defaultInternet: TInternetAccess; inline; |
function defaultQueryEngine: TXQueryEngine; inline; |
procedure needInternetAccess; deprecated 'This procedure no longer does anything'; |
Types
IXQValue = xquery.IXQValue; |
Description
Functions and Procedures
function retrieve(data: string): string; |
It is really simple to use, you pass the desired url as single parameter and get the data of the url. It supports: |
function httpRequest(url: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
Warning: this symbol is deprecated: The httpRequest functions have been moved to the internetaccess unit. |
function httpRequest(url: string; rawpostdata: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
Warning: this symbol is deprecated: The httpRequest functions have been moved to the internetaccess unit. |
function httpRequest(url: string; postdata: TStringList): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
Warning: this symbol is deprecated: The httpRequest functions have been moved to the internetaccess unit. |
function httpRequest(const method, url, rawdata: string): string; overload; deprecated 'The httpRequest functions have been moved to the internetaccess unit.'; |
Warning: this symbol is deprecated: The httpRequest functions have been moved to the internetaccess unit. |
function httpRequest(const destination: xquery.IXQValue): string; overload; deprecated 'Use destination.retrieve() instead.'; |
Warning: this symbol is deprecated: Use destination.retrieve() instead.
Make a http request to an address given in an IXQValue. |
function process(data: string; query: string): xquery.IXQValue; |
Processes data with a certain query. data can be an url, or a html/xml file in a string, like in retrieve. query can be a Or query can be a html template like This function returns an IXQValue value, which is a variant for XQuery expression. If you want a string value, you can convert it like The global function processedTree returns a tree representation of the last processed data string. |
function processedTree: TTreeNode; |
Returns a tree representation of the last processed html/xml data |
function processedVariables: TXQVariableChangeLog; |
Returns all variable assignments during the last query |
procedure freeThreadVars; |
If you use the functions in this unit from different threads, you have to call |
function defaultInternet: TInternetAccess; inline; |
function defaultQueryEngine: TXQueryEngine; inline; |
procedure needInternetAccess; deprecated 'This procedure no longer does anything'; |
Warning: this symbol is deprecated: This procedure no longer does anything |
Types
IXQValue = xquery.IXQValue; |
IXQValue from the xquery unit. Just a wrapper, so that no other unit needs to be included |
Generated by PasDoc 0.16.0.