m4merg has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Monks!
I'm trying to use LWP::UserAgent to get content from URL. I've succeed, but after some time URL just banned my IP (at least i think that they did, because I could not access to site at all). So i decided to use proxy, but i still can't get to this URL. Here is the code im using for this:
my $ua = new LWP::UserAgent; my $proxy = "http://112.137.164.232:3128"; $ua->proxy(['https'], $proxy); $ua->agent('Mozilla/5.0'); my $links = "http://sci-hub.org/"; my $req = new HTTP::Request GET => $links; my $stuff = $ua->request($req); print "Content-type: text/html\n\n"; print $stuff->content;
Using this code i can get content from another URL (for ex. google.com), but cant get it from the desired one (sci-hub.org). Also i actually can get access to the desired URL through web browser using this proxy (though i can't without proxy as they banned me), but can't get it from perl script:
Can't connect to sci-hub.org:80 (Connection timed out) LWP::Protocol::http::Socket: connect: Connection timed out at /usr/sha +re/perl5/LWP/Protocol/http.pm line 41
So, proxy is correct in general and code is correct in general (at least i think so), but for the desired URL it doesnt work. So what is the problem?
Sorry if I duplicate another topic, but i've searched for the solution of my problem hard (on this site also), used a lot of different ways and didnt find anything usefull at the end and thanks in advance for any help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Another one perl LWP question
by marto (Cardinal) on Jul 03, 2015 at 11:33 UTC | |
by marinersk (Priest) on Jul 03, 2015 at 11:46 UTC | |
by marto (Cardinal) on Jul 03, 2015 at 11:49 UTC | |
by marinersk (Priest) on Jul 03, 2015 at 11:57 UTC | |
by m4merg (Initiate) on Jul 03, 2015 at 11:47 UTC | |
|
Re: Another one perl LWP question
by hippo (Archbishop) on Jul 03, 2015 at 11:39 UTC | |
by m4merg (Initiate) on Jul 03, 2015 at 11:53 UTC | |
by hippo (Archbishop) on Jul 03, 2015 at 12:59 UTC | |
|
Re: Another one perl LWP question
by marinersk (Priest) on Jul 03, 2015 at 11:40 UTC | |
by m4merg (Initiate) on Jul 03, 2015 at 13:16 UTC | |
by marinersk (Priest) on Jul 04, 2015 at 02:10 UTC |