Xbasic

HTTP_GET_PAGE2 Function

Syntax

Page_Text as C = http_get_page2(url as C [,include_headers as L [,timeout as N]])

Arguments

urlCharacter

The URL of the selected page.

include_headersLogical

Default = .F.. .T. = Includes the headers of the server response along with the body. This is similar to the behavior of HTTP_GET_PAGE Function.

timeoutNumeric

Default = . Specifies the time, in seconds, after which the function should time out if a complete response has not been received from the server.

Returns

Page_TextCharacter

The HTML text of the selected page. Null if the server cannot be contacted.

Description

Use the HTTP method GET to retrieve the specified URL.

HTTP_GET_PAGE2() is not server-safe and cannot be used in an A5W environment.

The HTTP_GET_PAGE2() function retrieves the body of a selected page using HTTP/1.1 GET. This function uses ActiveX to request the site through Internet Explorer so it should use your Internet Explorer cookies, stored passwords, cache and other settings. Contrast with the HTTP_GET_PAGE Function which returns the full response including the headers sent by the remote server.

HTTP_GET_PAGE2() supports SSL when you use " https://... ".

A HTTP GET is different from a HTTP POST in two significant ways. Some devices may restrict the total length of a URL to 128 characters, which may trim the arguments appended by a GET command. There is no such restriction with POST commands. You may save (bookmark) and refresh URLs formatted through a HTTP GET command. The arguments sent by a HTTP POST command are not saved in a bookmark.
HTTP_GET_PAGE2() uses a Microsoft component named IXMLHTTPRequest. When calling a HTTPS URL, if the certificate does not match, the object puts up a dialog box prompting the user to accept or reject the certificate. The Interactive Window cannot show this dialog, but if you use HTTP_GET_PAGE2() from a script, you will see the dialog come up and ask what you would like to do.

Example 

dim cc as C
cc = http_get_page2("http://my.yahoo.com/")
? cc = <html><head><title>Welcome to My Yahoo!</title><meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://my.yahoo.com" r ( nz 0 vz 0 lz 0 oz 0 ca 1))'><link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"><style type="text/css">
                <!--
.hb {background-color:#770077;}
.sb {background-color:#dcdcdc;}
.hf {font-family:Arial;color:#ffff00;}
.sf {font-family:Arial;font-size:smaller;color:#000000;}
.bb {background-color:#ffffff;}
.bf {color:#ffffff;}
.nb {background-color:#eeeeee;}
.btn {cursor:hand;font-family:Verdana,"MS Sans Serif",Charcoal,Chicago,Arial;font-weight:normal;font-size:smaller;color:#000000;background-color:#dcdcdc;}
.an {background-color:#fdfdfd;}
.aw {background-color:#ffffff;}
body,table,tr,td,th,tt {}
-->
            </style>
            <script language=javascript>
                <!--
var remote = NULL;
function rs(n,u,w,h) {
remote = window.open(u, n, 'width=' + w + ',height=' + h +',resizable=yes,scrollbars=yes');
if (remote != NULL) {
if (remote.opener == NULL)
...

See Also