I know this is easy but I have stuck
I am using the Xojo.Net.HTTPSocket with Get and I want all the response headers to Textfield,with CURLSMBS is easy but I don’t know with Xojo.Net.HTTPSocket
Can someone give me a small example how to ?
Thank you
Have-you put code in the HeadersReceived Event ?
Or used RequestHeader ?
I do that using Classic code; I had to use a loop to get all headers (and I put that in a TextField (or was it a TextArea ?), years ago.
Thank you Emile,no I don’t have any code in HeadersReceived Event.
I don’t know what I put there because the manual have only have the “Called when headers are received from the server.”
I know the headers have received, i don’t know how to fetch this data…
I do not know where the project (where I used to request headers) resides, but I found a download log. Heres the relevant part:
2018-02-10 19:27:27: Connected to the site.
2018-02-10 19:27:28: Headers were received.
Received Internet Headers (7) :
1. Date: Sat, 10 Feb 2018 18:27:33 GMT
2. Server: Apache
3. Last-Modified: Mon, 19 Jun 2017 02:48:16 GMT
4. Accept-Ranges: bytes
5. Content-Length: 4998617
6. Connection: close
7. Content-Type: image/jpeg
2018-02-10 19:28:12: Item download complete.
Lines prefixed 1 thru 7 are the Headers
Like you, I was lost, and usually, a quest in the internet helps.
Example:
ResponseHeader(name As Text) As Text
Put the header you want data for in name, and read the answer (the Header) in the returned Text ?
You already have a project to make tests on.
Ypu may find information here: https://www.tutorialspoint.com/http/http_header_fields.htm useful.
In the Classic code, the returned information is either in an array or in text and I decode them like an array (this the 1-7 values in my returned headers lines).
What may also help (to understand my log extract) is Firefox. Load a web page (one), then issue ctrl-I or cmd-i and watch what is in the just opened window. You will recognize some data from the above log extract.
[quote=393139:@Emile Schwarz]I do not know where the project (where I used to request headers) resides, but I found a download log. Heres the relevant part:
2018-02-10 19:27:27: Connected to the site.
2018-02-10 19:27:28: Headers were received.
Received Internet Headers (7) :
1. Date: Sat, 10 Feb 2018 18:27:33 GMT
2. Server: Apache
3. Last-Modified: Mon, 19 Jun 2017 02:48:16 GMT
4. Accept-Ranges: bytes
5. Content-Length: 4998617
6. Connection: close
7. Content-Type: image/jpeg
2018-02-10 19:28:12: Item download complete.
Lines prefixed 1 thru 7 are the Headers
Like you, I was lost, and usually, a quest in the internet helps.
Example:
ResponseHeader(name As Text) As Text
Put the header you want data for in name, and read the answer (the Header) in the returned Text ?
You already have a project to make tests on.
Ypu may find information here: https://www.tutorialspoint.com/http/http_header_fields.htm useful.
In the Classic code, the returned information is either in an array or in text and I decode them like an array (this the 1-7 values in my returned headers lines).
What may also help (to understand my log extract) is Firefox. Load a web page (one), then issue ctrl-I or cmd-i and watch what is in the just opened window. You will recognize some data from the above log extract.[/quote]
Thank you Emily now I figure out how to !!