|
|
|
|
|
- Header of HTTP request
- Managing the errors of Web server
- Operating mode of HTTPRequest/HTTPGetResult with a destination
- Retrieval
HTTPGetResult (Function) In french: HTTPDonneRésultat Retrieves the result or the header of last HTTP request run. This request was initiated by HTTPRequest or by HTTPSendForm.
ResLancement = HTTPRequest("http://www.pcsoft.fr")
IF ResLancement = True THEN
ResCode is string = HTTPGetResult()
Info("Code HTML : " + ResCode)
ResEntête is string = HTTPGetResult(httpHeader)
Info("Entête : " + ResEntête)
ResCookie is string = HTTPGetResult(httpCookie)
Info("Cookie : " + ResCookie)
END
Url is string
Res_HTTP is string
ErreurHTTP is string
Url = "http://www.amazon.fr/s/ref=nb_ss?__mk_fr_FR=AMAZON&url" + ...
"=search-alias=aps&field-keywords=2746049805"
IF HTTPRequest(Url) THEN
Res_HTTP = HTTPGetResult()
IF Length(Res_HTTP) = 0 THEN
ErreurHTTP = HTTPGetResult(httpHeader)
Error(ErreurHTTP)
END
END
Syntax
<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: | | httpCookie | Block of cookies (extracted from the HTTP headers). | httpHeader | Header of last HTTP request. | httpResult (Default value) | Result of last HTTP request. Warning: In this case, in Unicode, <Résultat> is a Buffer. |
Remarks 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: ResLancement = HTTPRequest("http://www.pcsoft.fr")
The retrieved header is: HTTP/1.1 200 OK<\r><\n> Date: Tue, 10 Jul 2001 13:19:08 GMT<\r><\n> Server: 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> Connection: 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 Server: Server x-amz-id-1: 1KR8DDF5DV380D14DHTC x-amz-id-2: pU0oo3rO/L+5kLNg4Yc4MPd0jF3qwyEI4nGaOhMgYkk= Location: http://www.amazon.fr/WinDev-14-fondamentaux-d%C3%A9veloppement -Pr%C3%A9sentation/dp/2746049805/ref=sr_11_1/277-8952281-8252733?ie= UTF8&qid=1254325128&sr=11-1 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 Retrieval HTTPGetResult can also be used to retrieve an image or a binary document (see the Example).
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|