ph_geturl1 PowerHome formula function
Description
Gets the resulting HTML code from the specified URL.
Syntax
ph_geturl1 ( as_url, ai_type, al_timeout )
ph_geturl1 ( as_url, as_headers, ai_type, al_timeout )
Argument Description
as_url String. The URL whose HTML you wish to retrieve
as_headers String (Optional). Additional HTTP headers you would like to be sent as part of the request. Specify headers in the same format that would be used for structuring a valid HTTP request. Separate multiple headers with either a carriage return / linefeed pair or a linefeed (use the same separator for ALL the headers). An example header may look like: "Accept-Type: text/html~r~nPragma: no-cache". If this parameter is omitted, an empty string "" will be used
ai_type Integer. A number representing the method of HTML retrieval from the URL. See usage below for an explanation of the valid types
al_timeout Long. The max length of time in either seconds or milliseconds (dependent upon the ai_type value) to wait for the HTML return before the function times out
Return value
String. The raw HTML returned from the requested URL. Various errors may be encountered depending upon the method used to retrieve the HTML specified by the ai_type parameter. If an error occurs, the return value will start with "*ERROR* - " followed by a description of the error 
Usage
This function is an upgraded and expanded version of the original ph_geturl function.

The following table details the valid values for the ai_type parameter:
0 A type of 0 will cause the HTML to be retrieved via a raw socket (this is the same as the ph_geturl function). The HTTP request is constructed internally and then sent via a raw socket. The al_timeout parameter is in seconds
1 A type of 1 will retrieve the HTML using a Catalyst HTTP control. The al_timeout parameter is in seconds
2 A type of 2 will also retrieve the HTML using a Catalyst HTTP control but does so using slightly different methods than type 1 in case one or the other has compatibility problems. The al_timeout parameter is in seconds
3 A type of 3 will also retrieve the HTML using a Catalyst HTTP control but does so using a different method than type 1 or type 2. The al_timeout parameter is in seconds
4 Retrieves the HTML using an PowerBuilder internal HTTP control. This method does not support additional HTTP headers and any specified headers will be ignored. The al_timeout parameter is in seconds
5 Retrieves the HTML using an "msxml2.xmlhttp" control. The al_timeout parameter is in milliseconds
6 Retrieves the HTML using an "msxml2.serverxmlhttp" control. The al_timeout parameter is in milliseconds
7 Retrieves the HTML using a "winhttp.winhttprequest" control. The al_timeout parameter is in milliseconds
8 Retrieves the HTML using a C# WebRequest object. The al_timeout parameter is in milliseconds
9 Retrieves the HTML using a C# HttpWebRequest object. The al_timeout parameter is in milliseconds
10 Retrieves the HTML using a C# WebClient object with the DownloadString function. The al_timeout parameter is not relevant since this method does not allow specifying a timeout
11 Retrieves the HTML using a C# WebClient object with the OpenRead function. The al_timeout parameter is not relevant since this method does not allow specifying a timeout
12 Retrieves the HTML using a C# WebClient object with the DownloadString function. The C# WebClient object has been extended such that it supports timeout values. The al_timeout parameter is in milliseconds
13 Retrieves the HTML using a C# WebClient object with the OpenRead function. The C# WebClient object has been extended such that it supports timeout values. The al_timeout parameter is in milliseconds
Any other value Any other value will result in an empty string "" being returned
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_geturl1("https://weather.com/weather/today/l/28.69,-81.53?par=google&temp=f",1,5)
The above example will retrieve the raw HTML for the weather.com website using an HTTP Catalyst control. The function will timeout in 5 seconds if the result hasnt been returned by then.