in reply to LWP::Simple::get($url) does not work for particular urls
Hi, using getprint() instead shows the error:
( ... because, as the doc for LWP::Simple states:500 Can't connect to www.cryptopia.co.nz:443 (certificate verify faile +d) <URL:https://www.cryptopia.co.nz/api/GetCurrencies>
"The get() function will fetch the document identified by the given URL and return it. It returns undef if it fails."While for getprint():
"If the request fails, then the status code and message are printed on STDERR. The return value is the HTTP response code.")
You should use the full LWP::UserAgent so you can disable SSL certificate checking, or use HTTP::Tiny, which has it disabled by default:
Partial output:use strict; use warnings; use HTTP::Tiny; use JSON; use Data::Dumper; my $url = "https://www.cryptopia.co.nz/api/GetCurrencies"; my $res = HTTP::Tiny->new->get( $url ); my $decoded_json = decode_json( $res->{'content'} ); print Dumper( $decoded_json ); __END__
$ perl 1206484.pl | head -20 $VAR1 = { 'Message' => undef, 'Error' => undef, 'Data' => [ { 'Status' => 'OK', 'StatusMessage' => undef, 'DepositConfirmations' => 20, 'Algorithm' => 'POS', 'Name' => '1337', 'MaxWithdraw' => '90000000', 'MinTip' => '166.66666666', 'Symbol' => '1337', 'Id' => 331, 'ListingStatus' => 'Active', 'IsTipEnabled' => bless( do{\(my $o = 0)}, 'JS +ON::PP::Boolean' ), 'WithdrawFee' => '0.01', 'MinWithdraw' => '20000', 'MinBaseTrade' => '2e-05' },
Hope this helps!
|
|---|