<p>I'm trying to fetch Wikipedia pages using <a href="http://search.cpan.org/dist/libwww-perl" rel="noreferrer">LWP::Simple</a>, but they're not coming back. This code:</p>

<pre><code>#!/usr/bin/perl
use strict;
use LWP::Simple;

print get("http://en.wikipedia.org/wiki/Stack_overflow");
</code></pre>

<p>doesn't print anything. But if I use some other webpage, say <code><a href="http://www.google.com" rel="noreferrer">http://www.google.com</a></code>, it works fine. </p>

<p>Is there some other name that I should be using to refer to Wikipedia pages? </p>

<p>What could be going on here?</p>

[{'answer_id': 24574, 'author': 'Jesse Beder', 'author_id': 112, 'author_profile': 'https://Stackoverflow.com/users/112', 'pm_score': 5, 'selected': True, 'text': '<p>Apparently Wikipedia blocks LWP::Simple requests: <a href="http://www.perlmonks.org/?node_id=695886" rel="noreferrer">http://www.perlmonks.org/?node_id=695886</a></p>\n\n<p>The following works instead:</p>\n\n<pre><code>#!/usr/bin/perl\nuse strict;\nuse LWP::UserAgent;\n\nmy $url = "http://en.wikipedia.org/wiki/Stack_overflow";\n\nmy $ua = LWP::UserAgent-&gt;new();\nmy $res = $ua-&gt;get($url);\n\nprint $res-&gt;content;\n</code></pre>\n'}, {'answer_id': 24588, 'author': 'SHODAN', 'author_id': 2622, 'author_profile': 'https://Stackoverflow.com/users/2622', 'pm_score': 3, 'selected': False, 'text': '<p>Because Wikipedia is blocking the HTTP user-agent string used by LWP::Simple.</p>\n\n<p>You will get a "403 Forbidden"-response if you try using it.</p>\n\n<p>Try the LWP::UserAgent module to work around this, setting the agent-attribute.</p>\n'}, {'answer_id': 72847, 'author': 'Jonathan Swartz', 'author_id': 9942, 'author_profile': 'https://Stackoverflow.com/users/9942', 'pm_score': 3, 'selected': False, 'text': '<p>Also see the Mediawiki related CPAN modules - these are designed to hit Mediawiki sites (of which wikipedia is one) and might give you more bells and whistles than simple LWP.</p>\n\n<p><a href="http://cpan.uwinnipeg.ca/search?query=Mediawiki&amp;mode=dist" rel="noreferrer">http://cpan.uwinnipeg.ca/search?query=Mediawiki&amp;mode=dist</a></p>\n'}, {'answer_id': 73107, 'author': 'zigdon', 'author_id': 4913, 'author_profile': 'https://Stackoverflow.com/users/4913', 'pm_score': 4, 'selected': False, 'text': '<p>You can also just set the UA on the LWP::Simple module - just import the $ua variable, and it\'ll allow you to modify the underlying UserAgent:</p>\n\n<pre><code>use LWP::Simple qw/get $ua/;\n$ua-&gt;agent("WikiBot/0.1");\nprint get("http://en.wikipedia.org/wiki/Stack_overflow");\n</code></pre>\n'}, {'answer_id': 13192749, 'author': 'Samed Konak', 'author_id': 1792543, 'author_profile': 'https://Stackoverflow.com/users/1792543', 'pm_score': 3, 'selected': False, 'text': '<p>I solved this problem using <code>LWP:RobotUA</code> instead of <code>LWP::UserAgent</code>. You can read the document below. There are not much differences you should modify.</p>\n\n<p><a href="http://lwp.interglacial.com/ch12_02.htm">http://lwp.interglacial.com/ch12_02.htm</a></p>\n'}]
['https://Stackoverflow.com/questions/24546', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112/']