HTTP 요청을 만들고 응답 내용과 응답 헤더를 모두 얻으려면 어떻게해야합니까?Pharo에서 HTTP 요청하기 및 응답 헤더 받기
3
A
답변
3
아마도 가장 쉬운 방법은 WebClient
을 http://www.squeaksource.com/WebClient에서로드하는 것입니다.
0
1
을 위해, 더 그들과 함께 해변 번의 클릭으로 이미지를 뭔가를하려는 경우 :
(Installer ss project: 'WebClient')
install: 'WebClient-Core'
다음
response := WebClient httpGet: 'http://www.google.com/'.
headers := response headers. "An OrderedCollection of headername -> headervalue"
body := response content.
5
또는 새 Zinc framework을 다음과 같이 사용 :
| response content headers |
response := ZnClient new
url: 'http://stackoverflow.com';
get;
response.
content := response contents.
headers := response headers.
WebClient에는 실제 유용한 문서가 있습니다. –