Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making an HTTP request in Pharo and getting the response headers

how can I make an HTTP request and get both the response content and the response headers?

like image 804
dave Avatar asked Aug 22 '10 23:08

dave


2 Answers

Or using the new Zinc framework, something like:

| response content headers |

response := ZnClient new 
    url: 'http://stackoverflow.com';
    get;
    response.

content := response contents.
headers := response headers.
like image 82
martineg Avatar answered Oct 20 '22 00:10

martineg


Probably the easiest is if you load WebClient from http://www.squeaksource.com/WebClient.

like image 39
Lukas Renggli Avatar answered Oct 20 '22 00:10

Lukas Renggli