As the title says, I need to send a HTTPS GET request, then read the JSON reply in plain text. I prefer python, but I can use perl as well.
EDIT: Allright, so now I can get the data from the page, but the reply data is SSL encrypted, how would I decrypt it?
2 Answers 2
For Perl:
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);
answered Feb 4, 2012 at 21:11
GoldenNewby
4,4728 gold badges36 silver badges44 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Python:
import json
import urllib2
data = json.loads(urllib2.urlopen(url).read())
answered Feb 4, 2012 at 18:35
Jakub Roztocil
16.3k5 gold badges53 silver badges52 bronze badges
1 Comment
Patrick Perini
+1, but it's worth noting that for
urllib2 to handle an HTTPS request, the Python install needs to support SSL.default
urllib2andjsonshould do the job