in reply to Re: method not supported
in thread method not supported

Well, I don't see the problem, and testing and tinkering with it I couldn't get your code to work. I did try assigning an agent name to make it look like the request was coming from Firefox instead of LWP::UserAgent, just in case the server is blocking robots.

I did re-write the code, to more closely match the synopsis given in the docs for LWP::UserAgent, and that seemed to do the trick:

use strict; use LWP::UserAgent; my $word = "happy"; my $url = "http://dic.naver.com/search.naver?mode=all&query=" . $word; my $agent = new LWP::UserAgent; $agent->agent('Firefox/1.5'); my $response = $agent->get( $url ); if( $response->is_success ) { print $response->content(); } else { die $response->status_line; }

See if you can adapt that to your needs, because it seemed to work fine for me.


Dave

Replies are listed 'Best First'.
Re^2: method not supported
by Anonymous Monk on Dec 28, 2005 at 17:34 UTC

    Yes, your correction works perfectly ... the difference seems to be this line ...

    $agent->agent('Firefox/1.5');

    this seems to be required for some sites but not others ... and I missed it somehow when I was looking at docs ...

    as for my potentially heinious intentions (LOL) - I'm a foreign language instructor in Korea - I use a copy of Boutell's PerlMud 3.0 with a POE skeleton running a bunch of mud bots as part of my cirr. ... a very minor part of the bots that I'm working on is the ability to define words, offer spelling suggestions, syn and antonyms - that kind of thing ...

    the students aren't allowed to surf so unless the bots provide it they're SOL ... I stumbled on my problem when I switched online dictionaries - found one with more understandable definitions for foreign language students ... and better xml for parsing ...

    Thanks