2012-02-04 10 views
1

タイトルによれば、HTTPS GETリクエストを送信してから、JSON返信をプレーンテキストで読み取る必要があります。私はPythonを好むが、私もperlを使うことができる。HTTPSリクエストを取得してJSON返信を受け取ります

編集:これでページからデータを取得できますが、返信データはSSLで暗号化されていますが、どのように復号化すればよいですか?

+0

'urllib2'と' json'ジョブ –

答えて

1

のPython:Perl用の

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

+1を行う必要がありますが、それは '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); 
関連する問題