nachtmsk has asked for the wisdom of the Perl Monks concerning the following question:
https://api.bridgedataoutput.com/api/v2/OData/test/TestData?access_token=xxxxxxxxxxxxxxxxxxxxxx
If I type this URL into my browser it brings back the data I need. However, if I use it in the code below I get the 'die' message I have set below. My main task right now is to just get the data from the URL into a perl variable. Later on I can worry about parsing the JSON. I have used LWP before to get data this way, usually XML. I can't figure out why this isn't working.
Any help would be appreciated.---------------------------
Thanks! Mikeuse strict; use warnings 'all'; use LWP::Simple 'get'; use JSON::Parse 'parse_json'; use constant URL => 'https://api.bridgedataoutput.com/api/v2/OData/tes +t/TestData?access_token=xxxxxxxxxxxxxxxxxxxxxx'; my $json = get URL or die "Unable to get JSON data"; my $data = parse_json($json); print $data;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting JSON data from a URL using LWP
by choroba (Cardinal) on Jan 23, 2020 at 21:08 UTC | |
by nachtmsk (Acolyte) on Jan 23, 2020 at 21:50 UTC | |
by nachtmsk (Acolyte) on Jan 23, 2020 at 22:00 UTC | |
by hippo (Archbishop) on Jan 23, 2020 at 22:11 UTC | |
by nachtmsk (Acolyte) on Jan 23, 2020 at 23:58 UTC | |
by marto (Cardinal) on Jan 24, 2020 at 06:10 UTC | |
by nachtmsk (Acolyte) on Jan 23, 2020 at 23:37 UTC |