2012-02-04 5 views
1

제목에서 알 수 있듯이 HTTPS GET 요청을 보낸 다음 일반 텍스트로 JSON 응답을 읽어야합니다. 나는 파이썬을 선호하지만 perl도 사용할 수있다.HTTPS 요청 받기 및 JSON 응답 읽기

편집 : 좋아요, 이제 페이지에서 데이터를 가져올 수 있지만 회신 데이터는 SSL로 암호화되어 있습니다. 어떻게 해독하겠습니까?

+0

'urllib2'와'json'이 작업 –

답변

1

파이썬 : 펄 들어

import json 
import urllib2 
data = json.loads(urllib2.urlopen(url).read()) 
+0

일을해야하지만,가'urllib2'가를 처리 할 수 ​​있음을 주목할 필요가 HTTPS 요청을 보내면 Python 설치가 SSL을 지원해야합니다. –

2

:

use JSON; # We will use this to decode the result 
use LWP::Simple; # We will use this to get the encoded data over HTTPS 
use Data::Dumper; # We will use this to display the result 

# Download the json data 
my $encoded_json = get("https://domain.com/url"); 

# Decode the json data 
my $result = decode_json($encoded_json); 

# Show the result in readable form 
print Dumper($result);