ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / HTTP functions
  • Notes
  • Security error in a secure transaction
  • Required permissions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Sends an HTTP request and waits for the response from the HTTP server.
Example
cMyRequest is httpRequest
cMyRequest.URL = "http://www.windev.com"
cMyResponse is httpResponse = HTTPSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse.Content)
END
Syntax

Syntax with an httpRequest variable Hide the details

<HTTP response> = HTTPSend(<HTTP request>)
<HTTP response>: httpResponse variable
Name of the httpResponse variable containing the response received from the HTTP server.
<HTTP request>: httpRequest variable
Name of the httpRequest variable that contains the characteristics of the HTTP request to be sent to the server.

Simplified syntax for sending a request Hide the details

<HTTP response> = HTTPSend(<URL>)
<HTTP response>: httpResponse variable
Name of the httpResponse variable containing the response received from the HTTP server.
<URL>: Character string
URL to interrogate.
AndroidAndroid Widget

Asynchronous syntax with an httpRequest variable Hide the details

HTTPSend(<HTTP request> , <WLanguage procedure>)
<HTTP request>: httpRequest variable
Name of the httpRequest variable that contains the characteristics of the HTTP request to be sent to the server.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure called during the response from the HTTP server. This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is httpResponse)
where <Response> is an httpResponse variable containing the response received from the HTTP server.
AndroidAndroid Widget

Simplified asynchronous syntax for sending a request Hide the details

HTTPSend(<URL> , <WLanguage procedure>)
<URL>: Character string
URL to interrogate.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure called during the response from the HTTP server. This procedure has the following format:
PROCEDURE <Procedure name>(<Response> is httpResponse)
where <Response> is an httpResponse variable containing the response received from the HTTP server.
Remarks

Notes

  • To find out what errors have occurred in the execution of this function:
    • If the server you have contacted cannot be reached, use ErrorOccurred and ErrorInfo..
    • If the server can be contacted, use the CodeEtat property of variable type httpResponse to find out the response (by default, 200 indicates that the request has been accepted; any error will be detailed by another HTTP code).
  • If cookie management is set up for the specified request (function HTTPCookieManage), after calling function HTTPSend the cookies received are updated in variable httpRequest.. Therefore, during the next call to HTTPSend with this request, the cookies will be taken into account.
  • From version 21, the redirections are automatically taken into account in the HTTP requests. To manually process redirections in HTTP requests, you must use the IgnoreError property of the httpRequest variable with the httpIgnoreRedirection constant.

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 site name 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, simply modify the IgnoreError property of the httpRequest variable:
Error returned by ErrorInfo
(with the errCode constant)
Value of the IgnoreError property of the httpRequest variable
(these values can be combined)
Description
httpErrorInvalidCertificate
Invalid certificate or certificate coming from an unknown company.
httpIgnoreInvalidCertificateThe certificate is ignored.
httpErrorInvalidCertificateName
The name of the site 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.
httpIgnoreDeprecatedIgnores errors related to the use of deprecated algorithms (e.g. SHA-1 certificate signature).
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.
httpIgnoreUnsafeRenegotiationIgnores the error stating that the server does not support secure renegotiation (RFC 5746).
httpIgnoreRevocationThe certificate found in the list of revoked certificates is not checked.

Remarks:
  • When the HTTP queries are run in several threads, the HTTP.IgnoreError variable has a specific value for each thread.
  • AndroidAndroid Widget The following errors are handled: httpIgnoreCertificateExpired, httpIgnoreCertificatInvalid, httpIgnoreCertificateNameInvalid, httpIgnoreRevocation, httpIgnoreRedirection.
AndroidAndroid Widget

Required permissions

This function changes the permissions required by the application.
Permission required: INTERNET.
This permission allows the applications to open the network sockets.
Business / UI classification: Business Logic
Component: wd300com.dll
Minimum version required
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 12/03/2024

Send a report | Local help