Developer's Guide : Frontend
Frontend Guide: Pages
Using the Proxy Scripts
You can also use the proxy utility to retrieve data from remote servers that emit either plain text, XML, or an XML variant (including, but not limited to WSDL/SOAP, HTML, RSS/RDF, and many more). This includes backend functionality on a remote server that uses CPAINT. See considerations and enhanced usage for more information.
A call to a remote server is essentially the same, with a few exceptions.
- You will need to know the input parameters of the remote page or server you are calling.
- The cpaint2.proxy.??? file will need to be located within your server's web root and accessible by the browser.
- Before calling cpaint.call(), you will need to set the cpaint.set_proxy_url() to the location of the cpaint2.proxy.??? file.
If the remote script was implemented using cpaint, you can pass the parameters as you would normally, including the remote_method and args parameters.
Note: You can find out if a remote script was implemented using CPAINT v2.x or above by passing the variable api_query either on the querystring or in the POST data in your browser. (You do not need to specify a value after the variable.) If it does, it will reply with a string in the following format:
CPAINT v[major].[minor].[revision]/[language] v[language version]
major = the major version number (ie: 2)
minor = the minor version number (ie: 0)
revision = the revision or release number (ie: 0)
language = the scripting language used (ie: ASP-VBscript)
language version = the version information of the language in use
However, if the remote script uses something other than CPAINT, you can ignore the remote_method parameter (best to pass an empty string - '') and to put the data to be passed to the remote script in the args parameter(s). For example, if the remote script expected an argument called query and you wanted to pass the value cpaint, the first args parameter should read query=cpaint. Additional parameters to be passed can be put in additional args parameters.
Here's an example HTML file that utilizes the cpaint proxy to retrieve data from Google.
google via cpaint