电脑安全

您当前的位置:主页 > 电脑安全 >

利用Yahoo! Search API开发自已的搜索引擎-php版-网络

来源:[db:来源]标题:   在这    编辑:电脑技术全能网 时间:2019-09-23 06:24

原标题:利用Yahoo! Search API开发自已的搜索引擎-php版-网络
   <?php// Yahoo Web Services PHP Example Code// Rasmus Lerdorf// www.dnjishu.com$appid = ''YahooDemo'';// 在这输出你请求的ID号$service = array(''image''=>''http://api.search.yahoo.com/ImageSearchService/V1/imageSearch'', ''local''=>''http://api.local.yahoo.com/LocalSearchService/V1/localSearch'', ''news''=>''http://api.search.yahoo.com/NewsSearchService/V1/newsSearch'', ''video''=>''http://api.search.yahoo.com/VideoSearchService/V1/videoSearch'', ''web''=>''http://api.search.yahoo.com/WebSearchService/V1/webSearch'');?><html><head><title>PHP Yahoo Web Service Example Code</title></head><body><form action="YahooSearchExample.php" method="GET">Search Term: <input type="text" name="query" /><br />Zip Code: <input type="text" name="zip" /> (for local search)<br /><input type="submit" value=" Go! " /><select name="type"><?php foreach($service as $name => $val) { if(!empty($_REQUEST[''type'']) && $name == $_REQUEST[''type'']) echo "<option SELECTED>$name</option>n"; else echo "<option>$name</option>n";} ?></select></form><?phpfunction done() {?></body></html><?phpexit;}if(empty($_REQUEST[''query'']) || !in_array($_REQUEST[''type''],array_keys($service))) done();// Ok, here we go, we have the query and the type of search is valid// First build the query$q = '

上一篇:结合使用PHP和RSS-网络编程

下一篇:没有了