Home | Sign in | English EN
  • Header of HTTP request
  • Managing the errors of Web server
  • Operating mode of HTTPRequest/HTTPGetResult with a destination
  • Retrieval
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Retrieves the result or the header of last HTTP request run. This request was initiated by HTTPRequest or by HTTPSendForm.
// Retrieve the elements of "www.windev.com" Web page
ResStart = HTTPRequest("http://www.windev.com")
IF ResStart = True THEN
ResCode is string = HTTPGetResult()
Info("HTML code: " + ResCode)
ResHeader is string = HTTPGetResult(httpHeader)
Info("Header: " + ResHeader)
ResCookie is string = HTTPGetResult(httpCookie)
Info("Cookie: " + ResCookie)
// Example for processing an error returned by the Web server
Url is string
HTTP_Res is string
HTTPError is string
Url = "http://www.amazon.fr/s/ref=nb_ss?__mk_fr_FR=AMAZON&url" + ...
// Send the request to the Amazon server
IF HTTPRequest(Url) THEN
// The request was sent, it was a valid URL
HTTP_Res = HTTPGetResult()
IF Length(HTTP_Res) = 0 THEN
// Error of the Web server,
// the error details can be found in the page header
HTTPError = HTTPGetResult(httpHeader)
<Result> = HTTPGetResult([<Type of information>])
<Result>: Buffer or character string
  • Result of last HTTP request if the httpResult constant is specified.
  • Header of last HTTP request if the httpHeader constant is specified.
<Type of information>: Optional constant
Type of information to retrieve:
Versions 15 and later
New in version 15
Block of cookies (extracted from the HTTP headers).
httpHeaderHeader of last HTTP request.
(Default value)
Result of last HTTP request.
Caution: In this case, in Unicode, <Result> is a Buffer.

Header of HTTP request

A header of HTTP request provides various information about the HTTP request (date, server used, etc.).
When running the following HTTP request:
ResStart = HTTPRequest("http://www.windev.com")
The retrieved header is:
HTTP/1.1 200 OK<\r><\n>
Date: Tue, 10 Jul 2001 13:19:08 GMT<\r><\n>
Serveur: Apache/1.3.11 (Unix) PHP/4.0.1<\r><\n>
Last-Modified: Thu, 04 Jan 2001 13:20:11 GMT<\r><\n>
ETag: "4107f-5f7b-3a54788b"<\r><\n>
Accept-Ranges: bytes<\r><\n>
Content-Length: 24443<\r><\n>
Connexion: close<\r><\n>
Content-Type: image/gif<\r><\n><\r>

Managing the errors of Web server

Some Web servers return an error in the http header. For example, the error can correspond to a notification for page move (url rewriting). If the content of the page returned by HTTPGetResult is empty, you must check the page header.
Example of error header when moving a page (url rewriting):
HTTP/1.1 302 MovedTemporarily
Date: Wed, 30 Sep 2009 15:38:48 GMT
Serveur: Serveur
x-amz-id-1: 1KR8DDF5DV380D14DHTC
x-amz-id-2: pU0oo3rO/L+5kLNg4Yc4MPd0jF3qwyEI4nGaOhMgYkk=
Location: http://www.amazon.fr/WinDev-14-fundamental-d%C3%A9veloppement
Vary: Accept-Encoding,User-Agent
nnCoection: close
Content-Type: text/html; charset=ISO-8859-15
Set-cookie: session-id-time=1254866400l; path=/; domain=.amazon.fr;
expires=Tue Oct 06 22:00:00 2009 GMT
Set-cookie: session-id=277-8952281-8252733; path=/; domain=.amazon.fr;
expires=Tue Oct 06 22:00:00 2009 GMT
Content-Length: 0
WEBDEV - Server codeAjax

Operating mode of HTTPRequest/HTTPGetResult with a destination

When a destination file is specified by HTTPDestination:
  • HTTPGetResult with the httpResult constant always returns an empty string ("").
  • HTTPGetResult 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.


HTTPGetResult can also be used to retrieve an image or a binary document (see the Example).
Component: wd270com.dll
Minimum version required
  • Version 9
This page is also available for…
Click [Add] to post a comment