1

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?

asked Feb 4, 2012 at 18:28
1
  • urllib2 and json should do the job Commented Feb 4, 2012 at 18:32

2 Answers 2

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
Sign up to request clarification or add additional context in comments.

Comments

1

Python:

import json
import urllib2
data = json.loads(urllib2.urlopen(url).read())
answered Feb 4, 2012 at 18:35

1 Comment

+1, but it's worth noting that for urllib2 to handle an HTTPS request, the Python install needs to support SSL.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.