2007/09/02 (日) 16:36:23        [qwerty]
URL間違ってるなこれ(;´Д`)

#!/usr/local/bin/perl
#
# yahoojwebsearch.pl
# Search example perl script Ver.1(2007/08/31)
# 2007 Yahoo Japan Corporation
# 
# 履歴  作成者      概要
# 1.0.0 K.Miyazawa 新規作成

#use strict;
use LWP::Simple;
use XML::Simple;
use CGI;

#recive query
$q = new CGI;
$query = $q->param('query');


# Set your unique Yahoo! Application ID
my $appID = "[insert your AppID]";

# keyword null
if (!$query){
print << "end_no_query";
Content-Type: text/html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Yahoo! JAPAN Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method=get action=./yjwebsearch.pl>
<input type=text name=query>
<input type=submit value=websearch >
<hr>
Web Services by <a href="http://developer.yahoo.co.jp/">Yahoo! JAPAN</a><br>
</body>
</html>
end_no_query
exit;
}

# Construct a Yahoo! JAPAN Web Search
my $base_url = "http://api.search.yahoo.co.jp/WebSearchService/V1/webSearch";
my $type = "all"; #alternates: any, phrase.
my $results = 50;
my $language = "ja"; 
my $results_sort = "rank"; #alternate: date.
my $req_url = "$base_url?appid=$appID&query=$query&results=$results";

$req_url .= "&language=$language&sort=$results_sort";

# Make the request
my $yahoo_response = get($req_url);