1

Possible Duplicate:
Why can't I fetch wikipedia pages with LWP::Simple?

First of all I would like to say I have no experience at all at Perl. In fact, I only started studying it today.

However, I came across a strange problem which I can't seem to solve it or look for a solution online. My code is as follows:

#!/usr/bin/perl -w
use strict;
use LWP::Simple;

my $html = get("http://en.wikipedia.org/wiki/Perl") or die "ERROR";
  print $html;

For some reason, this throws "ERROR" at me in every attempt of running the application. Strangely enough, if I replace the Wikipedia article with "http://www.google.com" or practically anything else, it works rather well.

What could be the problem?

Thank you in advance.

Community
  • 1
  • 1
ronash
  • 856
  • 1
  • 9
  • 15

1 Answers1

1

Wikipedia refuses to answer anonymous callers. Set your user agent properly. Also, be aware that they dislike programmatic requests; there is an API for that, and you can also download the whole database.

Amadan
  • 191,408
  • 23
  • 240
  • 301