Biferno 1.7 Tabasoft.it

Application: ItaliaScuola Back-Office3
Reference
Admin | Edit | Reference | Cache | Logs
Click on a class name to see the description of that particular class:

Predefined Classes

ansi
array
biferno
boolean
cacheItem
char
classInfo
client
collection
curApp
curFile
curScript
db
double
error
file
folder
header
httpPage
imageUtils
int
long
memberInfo
multipart
object
ref
regexp
request
search
serverInfo
smtp
stackItem
string
time
unix
unsigned
 

Application Classes

Banner
BrowserBar
Ctrl_Form
FCKeditor
Form
GridChartGraph
Histogram
LocalDate
Result
condb
cookie
folderExt
headerExt
httpExt
mysqlFulltext
objHtml
requestExt
tableExport
utils
 

Functions

Functions

httpPage

Method:

Exec

httpPage Exec(string server, int port=80)

Remote Execution of Internet Resources

Description:

Use Exec method to insert in a Web page content that resides on a remote server accessible only via the HTTP protocol. The Exec method of the httpPage class allows to “execute” a HTTP page described by an object of the httpPage class and can be used to send to a remote server a request for an Internet resource (a HTML page, an image, a movie, or anything else).

Parameters:
server

specifies the server name (including the domain name) or the IP address of the server where the page we want to execute resides

port

indicates the port to be used (the default value is 80)

Returns:

an object of the httpPage class containing the server response, i.e. the requested page in case of success

Notes:

This is a simple function that executes a page request to a remote server and returns a string containing the body of the server response page.

function string ExecRemote(string site_address, string url)
{
	http_header = header("GET " + url + " HTTP/1.1")
	page_request = httpPage(http_header, "")
	page_response = page_request.Exec(site_address)
	return page_response.body
}

The ExecRemote function takes two strings as parameters, containing the site address and the path of the page that should be requested. The latter must always start with the / (slash) character, i.e. must be relative to the site root.

Within the function a header class object is created by passing a string consisting of a request (the actual header is empty) to the class constructor. The request consists in the GET method followed by the path of the page and protocol version.

On the next line an object of the httpPage class is created by passing the newly created header and an empty body to the class constructor. Then the Exec method is called on the object we just created using the site address as parameter.

The function returns the body of the server response page resulting from the call to the Exec method. An invocation of the ExecRemote function looks like the following:

result = ExecRemote("www.tabasoft.it", "/home.bfr")

The use of this function can be very useful in practice when we have to insert content (news, search forms, marketing polls) originating from another Web site in a box on the home page of our Web site and we do not want to use frames or inline frames (the latter are not supported by all browsers).

In this case the script that implements our home page can execute the remote page of interest and incorporate the result (typically HTML code) in our page. Another scenario is a site distributed across multiple remote machines. In this case the ExecRemote function is a very useful tool to exploit resources on remote computers.

Errors:

ErrServerRespondedNoData

Implementation:
C
 

Return to the httpPage class