PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Security error in a secure transaction
  • Retrieval
  • Accessing a password-protected URL
  • Using a proxy
  • Authentication headers
  • Limits
  • Required application feature
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Starts an HTTP request on a server. The result of the query (buffer) can be:
Versions 20 and later
WINDEV Tip: Use the HTTPSend function to execute an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
New in version 20
WINDEV Tip: Use the HTTPSend function to execute an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
WINDEV Tip: Use the HTTPSend function to execute an HTTP request. This function is using an httpRequest variable in order to precisely describe the HTTP request.
Remarks:
  • 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 maintain forms, you should use the form maintenance functions (HTTPCreateForm, HTTPSendForm, ...).
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
Universal Windows 10 App This function is now available in Windows Store apps 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.
// Récupération du code HTML de la page Web "www.pcsoft.com"
ResLancement = HTTPRequest("http://www.pcsoft.fr")
// Récupération d'une page HTML utilisant une URL protégée
ResLancement = HTTPRequest("http://www.pcsoft.fr", ...
"", "", "", "", "Julie", "MotDePasse")
Syntax
<Result> = HTTPRequest(<URL to contact> [, <User agent> [, <Additional HTTP header> [, <Message to send> [, <Message type> [, <Username> [, <Password>]]]]]])
<Result>: Boolean
  • True if the request was started,
  • False if an error occurred. To get the details of the error, use ErrorInfo with the errMessage constant.
    The result of the 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
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".
Remarks:
  • 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 (for more details, see HTTPParameter).
<User agent>: Optional character string
Identifies the client. 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, for more details, see the documentation of user agent.
<Additional HTTP header>: Optional character string
  • 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
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).
<Message type>: Optional character string
Type of the HTTP message content to 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/octet-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/octet-stream".
  • "text/xml".
To send rough data that will be read at once by the WEBDEV application server, use the following types:
  • "application/octet-stream".
  • "text/xml".
<Username>: Optional character string
Name used to access a page with a protected URL (empty string by default). This name is used to identify the user.
Remark: By filling in the <Name User> and <Password> parameters, the corresponding "Authorization:Basic" is automatically generated in the request header.
<Password>: Optional character string
Password associated with the username (empty string by default). Used to access a page with a protected URL. Caution: The password is not encrypted when it is sent over the Internet.
Remark: By filling in the <Name User> and <Password> parameters, the corresponding "Authorization:Basic" is automatically generated in the request header.
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 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, 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:
// Lancement d'une requête sur un serveur sécurisé
ResLancement = HTTPRequest("https://www.MonServeur.com")
// Si erreur rencontrée
IF ResLancement = False THEN
// Selon le type d'erreur rencontré
SWITCH ErrorInfo(errCode)
// Certificat invalide
// ou ne provenant pas d'une société connue
CASE httpErrorInvalidCertificate:
// Ignorer le certificat?
IF YesNo("Alerte de sécurité détectée!", ...
"Certificat invalide.", ...
"Ignorer ce certificat?") = Yes THEN
HTTP.IgnoreError = httpIgnoreInvalidCertificate
// Nouveau lancement de la requête
// en ignorant cette erreur
HTTPRequest("https://www.MonServeur.com")
END
// Date du certificat non-valide ou expiré
CASE httpErrorExpiredCertificate:
// Ignorer la date du certificat?
IF YesNo("Alerte de sécurité détectée!", ...
"Date du certificat invalide ou expiré.", ...
"Ignorer cette date?") = Yes THEN
HTTP.IgnoreError = httpIgnoreExpiredCertificate
// Nouveau lancement de la requête
// en ignorant cette erreur
HTTPRequest("https://www.MonServeur.com")
END
END
END
Remarks:
  • When the HTTP queries are run in several threads, the HTTP.IgnoreError variable has a specific value for each thread.
  • Universal Windows 10 App The errors regarding the security of transactions are ignored. The HTTP.IgnoreError variable is not available.
  • 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.

Retrieval

HTTPGetResult is used to retrieve the result of the last HTTP request run.
When a destination file is specified by HTTPDestination:
  • the HTTPGetResult function used with the httpResult constant always returns an empty string ("").
  • HTTPGetResult associated with the httpHeader constant always returns the header of the 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.
WINDEVUniversal Windows 10 AppUser code (UMC)

Accessing a password-protected URL

To access a password-protected URL, you can:
  • use the <Username> and <Password> parameters found in the syntax of HTTPRequest.
  • specify the username and password in the <URL to contact> parameter. For example:
    <Res> = HTTPRequête("http://<user>:<password>@<URL à contacter>")
WINDEVUser code (UMC)

Using a proxy

To access the URL specified in HTTPRequest via a proxy, use Proxy.
WINDEVUniversal Windows 10 AppUser code (UMC)

Authentication headers

The authentication headers are automatically generated in the following cases:
  • If HTTPRequest uses the syntax with username and password.
  • If the server URL is password protected.
  • If Proxy is used.
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

When this function is used, an application feature is declared in the application generation wizard.
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

When this function is used, an application feature is declared in the application generation wizard.
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

When this function is used, an application feature is declared in the application generation wizard.
Required feature: Internet and public networks (outgoing).
This feature allows the applications to use the accesses to Internet and to the public networks.
Component: wd270com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment