ph_geturlviaproxy1 PowerHome formula function
Description
Gets the resulting HTML code from a URL using the specified proxy server values.
Syntax
ph_geturlviaproxy ( as_url, as_proxy, al_proxyport, as_authorization, ai_type, ai_timeout)
ph_geturlviaproxy ( as_url, as_headers, as_proxy, al_proxyport, as_authorization, ai_type, ai_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
as_proxy String. The proxy server the request will made through.
al_proxyport Long. The proxy server port
as_authorization String. The userid and password for the proxy server. Separate the userid from the password using a colon character. Example: userid:password.
ai_type Integer. A number representing the method of HTML retrieval from the URL. See usage below for an explanation of the valid types.
ai_timeout Integer. The max length of time in seconds to wait for the HTML before the function times out.
Return value
String. The raw HTML returned from the requested URL.
Usage
This function is an upgraded and expanded version of the original ph_geturlviaproxy function.

The following table details the valid values for the 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_geturlviaproxy function). The HTTP request is constructed internally and then sent via a raw socket.
1 A type of 1 will retrieve the HTML using a Catalyst HTTP control.
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.
Any other value Any other value will cause the function to retrieve HTML using a Catalyst HTTP control using yet another method different from type 1 or type 2. Each of the types have various levels of compatibility and each type should be attempted to retrieve the most satisfactory results for a particular website.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_geturlviaproxy1("https://weather.com/weather/today/l/28.69,-81.53?par=google&temp=f","192.168.0.150",80,"userid:password",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.