ph_saveurlviaproxy1 PowerHome formula function
Description
Retrieves the output from a URL using
the specified proxy server values and saves it to a file.
Syntax
ph_saveurlviaproxy1 ( as_url, as_proxy, al_proxyport, as_authorization, as_file, ai_writemode, ai_type, ai_timeout )
ph_saveurlviaproxy1 ( as_url, as_headers, as_proxy, al_proxyport, as_authorization, as_file, ai_writemode, 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 |
as_file |
String. The full path and filename to save the URL output
to |
ai_writemode |
Integer. Controls how the data is saved.
Use 0 to append the output to the file. Use 1 to replace the file if it currently exists |
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_timeouot |
Integer. The max length of time in
seconds to wait for the HTML before the function times out
|
Return value
String. Returns either the HTTP headers from the URL or an
error message
Usage
Use this function to retrieve the output
from a URL via a proxy server and directly save it to a file. This will allow
you to retrieve binary data that isnt possible to retrieve using the ph_geturl
functions.
See the table below
for an explanation of options available to the type parameter:
0 |
Retrieves the URL output using a raw
socket. This would be identical to the method used by the ph_saveurlviaproxy
function. |
1 |
Retrieves the URL output using a
Catalyst HTTP control using method 1. |
2 |
Retrieves the URL output using a
Catalyst HTTP control using method 2. |
3 |
Retrieves the URL output using a
Catalyst HTTP control using method 3. |
Multiple
methods are provided as certain websites, operating systems, etc. may have a
problem with one method or the other. Choose the method that produces the most
desireable results.
Examples
The following examples demonstrate typical
syntax/usage for this function.
ph_saveurlviaproxy1("www.power-home.com/images/phwiki.gif","192.168.0.150",80,"userid:password","c:\powerhome\phwiki.gif",1,1,5)