SOAP::Lite::Simple::DotNetでMSN Search APIを使ってみました
実行すると検索結果のタイトルを出力します。
#!/usr/bin/perl
use encoding 'utf8';
use SOAP::Lite::Simple::DotNet;my $soap_simple = SOAP::Lite::Simple::DotNet -> new({
uri => 'http://schemas.microsoft.com/MSNSearch/2005/09/fex',
proxy => 'http://soap.search.msn.com/webservices.asmx?wsdl',
xmlns => 'http://schemas.microsoft.com/MSNSearch/2005/09/fex',
strip_default_xmlns => 1,
});
my $appID = "あなたのAppID";
my $query = "microsoft";
my $xml = "";
".$appID."
".$query."
ja-JP
Moderate
None
47.45
-122.30
0
10
Title Description Url
if( $soap_simple->fetch({
'method' => 'Search',
'xml' => $xml,
}) ){
my $xml_results = $soap_simple->results();
my $xml_obj = $soap_simple->results_xml();my @titles =
$xml_obj->findnodes(".//*[local-name()='Title']/text()");
foreach my $title( @titles ){
print $title->nodeValue."?n";
}
}else{
print "Problem using service:" . $soap_simple->error();
}
Microsoft Corporation
Fast Facts About Microsoft
microsoft's timeline from 1975 - 1990
Microsoft Research Social Computing Symposium 2004
Jeff Sandquist - Microsoft Evangelist
CRN | Breaking News | Microsoft Readying Windows Server 2003 R2 Beta
Microsoft Corporation - Money,Politics,Campaign Contributions ...
About the Frontline Partnership
Real Software Slams Microsoft's Patent Effort
Joint Status Report on Microsoft's Compliance with the Final Judgments ...
検索結果がhttp://search.msn.com/と違うんだけど…。
パラメータの値によるのかな?サンプルの値を適当に入れただけなので意味は調べてません(_ _;
SOAP::Lite::Simple::DotNetの使い方は下記URL参照。
http://search.cpan.org/~llap/SOAP-Lite-Simple-1.3/lib/SOAP/Lite/Simple/DotNet.pm