PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Security error in a secure transaction
  • Retrieval
  • Accessing a password-protected URL
  • Using a proxy
  • Authentication headers
  • Cache in Windows Mobile
  • Required permissions
  • Limits
  • Required application feature
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Starts an HTTP request on a server. The query result can be:
Versions 20 and later
WINDEVWEBDEV - Server codeiPhone/iPad Tip: Use HTTPSend to run an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
New in version 20
WINDEVWEBDEV - Server codeiPhone/iPad Tip: Use HTTPSend to run an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
WINDEVWEBDEV - Server codeiPhone/iPad Tip: Use HTTPSend to run an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
Notes:
  • Two types of requests are supported: POST and GET. The GET requests are automatic. If the "Message to send" is not specified, it is a GET request (see the syntax). To manage forms, we recommend that you use the functions for form management (HTTPCreateForm, HTTPSendForm, ...).
  • PHP HTTPRequest can be used only if the use of sockets is allowed on the PHP server. For an URL in HTTPS, OpenSSL must be compiled with the PHP engine used to generate the pages: http://www.php.net/
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications. HTTPRequest must be run in a thread.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications. HTTPRequest must be run in a thread.
Universal Windows 10 App This function is now available for the Windows Phone applications. HTTPRequest must be run in a thread.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
// Retrieve the HTML code of "www.windev.com" Web page
ResStart = HTTPRequest("http://www.windev.com")
// Retrieve an HTML page that is using a protected URL
ResStart = HTTPRequest("http://www.windev.com", ...
"", "", "", "", "Julia", "Password")
Syntax
<Result> = HTTPRequest(<URL to Contact> [,<User Agent> [,<Additional HTTP Header> [,<Message to Send> [,<Type of Message> [, <User Name> [, <Password>]]]]]])
<Result>: Boolean
  • True if the request was started,
  • False if an error occurred. To find out the error details, use ErrorInfo associated with the errMessage constant.
    The result of request can be saved in a backup file by HTTPDestination or it can be retrieved by HTTPGetResult.
    Universal Windows 10 AppJava The errors regarding the security of transactions are not returned by ErrorInfo: the connection is refused.
<URL to Contact>: Character string (with quotes)
Address of server to contact (URL address). This parameter can contain:
  • the port number for connecting to the server. The default value is 80 (corresponds to a server of Web pages). To specify a port number, use the following format: "<Server URL>:<Port #>". For example: http://www.windev.com:80.
  • additional parameters. These parameters can be used to perform a search or to fill a form. For example, to find "windev" on "http://www.google.com", the URL to contact will be: "http://www.google.com/search?q=windev".
Notes:
  • To specify both the port number and additional parameters, use the following format: "<Server URL>:<Port #>/<Additional Parameters>".
  • To perform a secure transaction, the URL must start with "https://". In this case, the management mode of requests is always performed by Internet Explorer (see HTTPParameter for more details).
    Linux The secure transactions are not supported.
<User Agent>: Optional character string (with quotes)
Identifies the client. The "PC SOFT Framework" value is returned by default.The application name is returned by default.
The content of the response may depend on the user agent (for example, a request performed from a mobile device and a request performed from a PC browser require different pages). In this case, see the documentation of the user agent for more details.
Windows Mobile Identifies the client. The "Mozilla/4.0 (compatible; MSIE 4.01 - Windows CE)" value is returned by default.
Indeed, the content of the response may depend on the user agent. For example, if the default value is used, the size of pages displayed will be adapted to the Pocket PC screen (only if this features is supported by the server of site viewed).
<Additional HTTP Header>: Optional character string (with quotes)
  • Additional HTTP header that will be added to the HTTP message,
  • Empty string ("") if no HTTP header must be added.
<Message to Send>: Optional character string (with quotes)
HTTP message that will be sent to the server. This parameter can be specified only for a request for sending messages (POST request). The message to send must comply with the HTTP protocol used. If this parameter is specified and if it is not empty, it is a POST request; otherwise, it is a GET request (everything else is automatic).
<Type of Message>: Optional character string (with quotes)
Type of content of HTTP message that will be sent to the server. This parameter can be specified only for a request for sending messages (POST request). This parameter corresponds to "Content-Type".
By default, the message type corresponds to: "application/x-www-form-urlencoded".
However, you have the ability to use any value, for example: "text/xml", "application/javascript", "application/json", "application/xml", "image/jpeg", ...
Versions 16 and later
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/byte-stream".
  • "text/xml".
New in version 16
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/byte-stream".
  • "text/xml".
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/byte-stream".
  • "text/xml".
<User Name>: Optional character string (with quotes)
Name used to access a page with a protected URL (empty string by default). This name is used to identify the user.
Note: If ..UserName and ..Password are specified, the corresponding "Authorization:Basic" is automatically generated in the request header.
Windows Mobile This parameter is taken into account only if the Web server asks for an authentication (basic authentication in IIS for example).
<Password>: Optional character string (with quotes)
Password associated with the user name (empty string by default). Used to access a page with a protected URL. Caution: The password is not encrypted when it is sent on Internet.
Note: If ..UserName and ..Password are specified, the corresponding "Authorization:Basic" is automatically generated in the request header.
Windows Mobile This parameter is taken into account only if the Web server asks for an authentication (basic authentication in IIS for example).
Remarks

Security error in a secure transaction

During a secure transaction, the request may fail due to security errors:
  • invalid certificate or certificate coming from an unknown company.
  • the name of the site specified in the certificate does not correspond to a server.
  • invalid or expired certificate date.
  • redirection to a non-secure server.
  • ...
These errors are returned by ErrorInfo.
If one of these errors occurs, you can re-run the request while ignoring the errors. To do so, use the HTTP.IgnoreError variable.
The HTTP.IgnoreError variable can also be used to manage special cases during the secure transactions (ignoring the list of revoked certificates for example).
Error returned by ErrorInfo
(with the errCode constant)
Value of HTTP.IgnoreError
(these values can be combined)
Description
httpErrorInvalidCertificate
Invalid certificate or certificate coming from an unknown company
httpIgnoreInvalidCertificateThe certificate is ignored.
httpErrorInvalidCertificateName
The site name specified in the certificate does not correspond to a server
httpIgnoreInvalidCertificateNameThe site name specified in the certificate is ignored.
httpErrorExpiredCertificate
Invalid or expired certificate date
httpIgnoreExpiredCertificateThe certificate date is ignored
httpErrorRedirectToHTTP
Redirection to a non-secure server
httpIgnoreRedirectToHTTPThe redirection to a non-secure server is allowed.
httpIgnoreRedirectToHTTPS
Redirection to a secure server
httpIgnoreRedirectToHTTPSThe redirection to a secure server is allowed.
httpIgnoreRedirectionThe redirection to a page is ignored.
httpIgnoreRevocationThe certificate found in the list of revoked certificates is not checked.
For example:
// Start a request on a secure server
ResStart = HTTPRequest("https://www.MyServer.com")
// If an error occurs
IF ResStart = False THEN
// According to the type of error
SWITCH ErrorInfo(errCode)
// Invalid certificate
// or coming from an unknown company
CASE httpErrorInvalidCertificate:
// Ignore the certificate?
IF YesNo("Security alert detected!", ...
"Invalid certificate.", ...
"Ignore this certificate?") = Yes THEN
HTTP.IgnoreError = httpIgnoreInvalidCertificate
// Start the request again
// while ignoring this error
HTTPRequest("https://www.MyServer.com")
END
// Invalid or expired certificate date
CASE httpErrorExpiredCertificate:
// Ignore the certificate date?
IF YesNo("Security alert detected!", ...
"Certificate date invalid or expired.", ...
"Ignore this date?") = Yes THEN
HTTP.IgnoreError = httpIgnoreExpiredCertificate
// Start the request again
// while ignoring this error
HTTPRequest("https://www.MyServer.com")
END
END
END
Notes:
  • When the HTTP queries are run in several threads, the HTTP.IgnoreError variable has a specific value for each thread.
  • AndroidAndroid Widget Universal Windows 10 AppJava The errors regarding the security of transactions are ignored. The HTTP.IgnoreError variable is not available.
  • Universal Windows 10 App The errors regarding the security of transactions are ignored. The HTTP.IgnoreError variable is not available.
  • AndroidAndroid Widget Java
    Before version 200057, the errors regarding the security of transactions were ignored. The HTTP.IgnoreError variable was not available.
    From version 200057, the following errors are supported: httpIgnoreExpiredCertificate, httpIgnoreInvalidCertificate, httpIgnoreInvalidCertificateName, httpIgnoreRevocation. The other errors are ignored. For backward compatibility, all the errors are ignored on the existing projects. These errors are supported on the new projects only.
    Versions 22 and later
    AndroidAndroid Widget The httpIgnoreRedirection error is also supported.
    New in version 22
    AndroidAndroid Widget The httpIgnoreRedirection error is also supported.
    AndroidAndroid Widget The httpIgnoreRedirection error is also supported.

Retrieval

HTTPGetResult is used to retrieve the result of last HTTP request run.
When a destination file is specified by HTTPDestination:
  • HTTPGetResult associated with the httpResult constant always returns an empty string ("").
  • HTTPGetResult associated with the httpHeader constant always returns the header of HTTP response. This header is not saved in the destination file: only the data is saved.
When the request is over, the destination is canceled and HTTPRequest operates as usual.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileUniversal Windows 10 AppPHPAjaxUser code (UMC)

Accessing a password-protected URL

To access a password-protected URL, you can:
  • use the <User Name> and <Password> parameters found in the syntax of HTTPRequest.
  • specify the login and password in the <URL to Contact> parameter. For example:
    <Res> = HTTPRequest("http://<user>:<password>@<URL to contact>")
WINDEVWEBDEV - Server codeReports and QueriesWindows MobilePHPAjaxUser code (UMC)

Using a proxy

To access the URL specified in HTTPRequest via a proxy, use Proxy.
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileUniversal Windows 10 AppPHPAjaxUser code (UMC)

Authentication headers

The authentication headers are automatically generated in the following cases:
  • If HTTPRequest is using the syntax with login and password.
  • If the server URL is password protected.
  • If Proxy is used.
Windows Mobile

Cache in Windows Mobile

In Windows Mobile, using a cache can trigger the retrieval of an unexpected result even if a request is repeated. To avoid using a cache, an additional HTTP header can be added. For example:
sAgent is string = "Mozilla/4.0 (compatible - MSIE 4.01 - Windows CE)"
Result1 = HTTPRequest("http://RequestUrl", sAgent, "Cache-Control: No-cache")
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission: INTERNET.
This permission allows the applications to open the network sockets.
Universal Windows 10 App

Limits

  • The proxy used is the one of Internet Explorer.
  • The certificates cannot be ignored.
Versions 21 and later
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Internet and public networks (outgoing).
This feature allows the applications to use the accesses to Internet and to the public networks.
New in version 21
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Internet and public networks (outgoing).
This feature allows the applications to use the accesses to Internet and to the public networks.
Universal Windows 10 App

Required application feature

The use of this function triggers the declaration of an application feature in the wizard for generating the application.
Required feature: Internet and public networks (outgoing).
This feature allows the applications to use the accesses to Internet and to the public networks.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Linux wd230com.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment