ph_posturlviaproxy1 PowerHome formula function
Description
Gets the resulting HTML code from a URL (via an HTTP POST operation)
using the specified proxy server values
Syntax
ph_posturlviaproxy1 ( as_url, as_postdata, as_proxy, al_proxyport, as_authorization, ai_type, ai_timeout )
ph_posturlviaproxy1 ( as_url, as_headers, as_postdata, 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_postdata |
String. The data to post to the
URL |
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. The method in which to post
the data. A type value of 0 will post the data using a raw socket control
with the data appropriately structured. Any other value will post the data using
a Catalyst HTTP control. |
ai_timeouot |
Integer. The max length of time in
seconds to wait for the HTML before the function times out.
|
Return value
String. The returned raw HTML from the
HTTP POST operation.
Usage
Most of the time, the ph_geturlviaproxy or
ph_geturlviaproxy1 function is all that is needed in order to retrieve raw HTML
from a website through a proxy server.. This is accomplished via an HTTP GET
command. Some websites though, for whatever reason, don't support an HTTP GET
and instead require an HTTP POST. This function allows you to retrieve data from
these websites. A very good explanation of the differences between POST and GET
can be found here:
http://www.w3schools.com/tags/ref_httpmethods.asp
Examples
The following examples demonstrate typical
syntax/usage for this function.
ph_posturlviaproxy1("http://www.weatherunderground.com","Host:
power-home.com","192.168.0.150",80,"userid:password",1,5)
The above example will retrieve the raw HTML for the
weatherundergound.com website using an HTTP Catalyst control. The function
will timeout in 5 seconds if the result hasnt been returned by then.