|
|
|
|
|
- Using a proxy
- How to check whether the proxy exists?
- Proxy and SOCKS5 protocol
Proxy (Function) In french: Proxy Specifies whether the communication functions that use HTTP or HTTPS must go through a proxy to execute their requests. A proxy is used to share the access to Internet between the different network computers. The relevant communication functions are as follows: - HTTP functions,
- DotNet functions,
- J2EE functions,
- SOAP functions,
- Google functions (Google Calendar functions, Google Contacts functions, Google Maps functions, Google document functions, ... ),
- Imported SOAP web services,
- ...
This function is only taken into account the next time a function that uses HTTP is called. Remarks: - Proxy configures the access to Internet via a proxy for the entire application.
- FTPProxy allows you to configure the use of a proxy for the FTP functions.
- SocketProxy determines if TCP sockets and WebSockets must go through a SOCKS5 proxy.
Proxy("192.168.0.1", 8080)
sHTMLCode is string = HTTPRequest("http://www.windev.com")
Info("The HTML code is: " + sCodeHTML)
Proxy("")
Syntax
Defining the proxy Hide the details
Proxy(<Proxy address> [, <Proxy port> [, <Username> [, <Password>]]])
<Proxy address>: Character string Address of proxy in the following format:- IP address in XXX.XXX.XXX.XXX format (125.5.110.100 for example).
- URL containing the server name (www.windev.com for example). This syntax is recommended.
- IP address returned by NetIPAddress.
- SOCKS5 proxy address, in the following format:
socks5://<Proxy IP address>
<Proxy port>: Optional integer Port number of proxy. This parameter is set to 80 if it is not specified. <Username>: Optional character string Authentication for the proxy. If this parameter is an empty string ("" by default), no authentication is performed. <Password>: Optional character string or secret string Password for authentication through the proxy. This parameter is ignored if <Username> is an empty string ("").
New in version 2025Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "Ansi or Unicode string". To learn more about secret strings and how to use the vault, see Secret string vault.
Removing a proxy
Proxy("")
Remarks How to check whether the proxy exists? The following code is used to check whether the proxy exists via SocketConnect: IF SocketConnect(lsSocketName, llSocketPort, lsSocketAddr) = False THEN
RETURN False
ELSE
SocketClose(lsSocketName)
END
Proxy and SOCKS5 protocol To use the SOCKS5 protocol with Proxy, simply prefix the name of the proxy server with "socks5://" and use the function with the standard syntax (passing the port and the identifiers). CAUTION: - A SOCKS5 proxy cannot be used if HTTP is configured to use WinInet (mode that uses Internet Explorer). This mode can be configured with the httpConfigureMode constant of HTTPConfigure.
- Calling HTTPRequest and HTTPSendForm with a proxy that uses SOCKS5 will force the use of the cURL command.
Therefore, it is recommended to use a variable of type httpRequest with a SOCKS5 proxy.
Example:
HTTPConfigure(httpConfigureMode, 1)
Proxy("socks5://172.12.2.79", 1080, "USER", "PWD")
req is httpRequest
req.URL = "https://www.google.com"
req is httpResponse = req.Send()
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info("OK")
END
Proxy("")
Related Examples:
|
Complete examples (WINDEV): WD HTTP Proxy
[ + ] This WINDEV example is a simplified HTTP proxy. You can save connections and find out which pages were viewed.
|
|
Complete examples (WINDEV): WD POP3Proxy
[ + ] This example presents a POP3 proxy. A proxy is a program that connects to a server on behalf of another program. A proxy can be used to isolate a local network from Internet for security reasons for example. Only the computer hosting the proxy is linked to Internet and the users access the email server via the proxy. In this example, the proxy is used to automatically archive the retrieved emails into a HFSQL database. Several additional features can be used in this application: automatic filtering of spams, statistics about the emails...
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|