PHP 使用 Bing API
PHP 使用 Bing API 首先你要去申請一個 Bing API KEY
申請地址: http://cn.bing.com/developers/
使用方法:
<?php
// Include the Bing API PHP Library
require 'library/BingAPI.php';
// Simply start the class with your AppID argumented
$search = new BingAPI('YOUR APPID KEY');
$search->query($searchWeb)
->setSources('Web') # To use multiple resources simply do ->setSources('Web+Image') , it must match the source type bling.com provides
->setFormat('xml')
->setOptions(array(
'Web.Count' => '20',
'Web.Offset' => '0',
'Adult' => 'Moderate',
'Options' => 'EnableHighlighting'));
// Contains the search
$results = $search->getResults();
/* To use highlighting features use
/* $search->setHighlightFormat(
&<span class='hl'>&,
&</span>&,
$SOURCE_TO_FORMAT
);
*/
/* If you don't want to highlight your title use
$search->resetHighlight($string_containing_bing's title);
*/
/* For advanced cURL Users, setProxy() has been removed, you will utilize $search->setCurlArray(array()); */
/* And for developers who constantly lurks in bing forums or other developer forums there is $search->getRequestedQueryURL(); it will retrieve the link you use
to query bing.com servers. eg. http://api.search.live.net/xml.aspx?AppId=YOUR APPD ID&Query=da&Sources=Image&Image.Count=20&Image.Offset=0&Image.Filters=Size:Small&Adult=Moderate&Options=EnableHighlighting
Note that it will return THE CURRENT URL.
*/
下載: BingAPI.php
關鍵字:PHP Bing API
新文章:
- CentOS7下圖形配置網(wǎng)絡的方法
- CentOS 7如何添加刪除用戶
- 如何解決centos7雙系統(tǒng)后丟失windows啟動項
- CentOS單網(wǎng)卡如何批量添加不同IP段
- CentOS下iconv命令的介紹
- Centos7 SSH密鑰登陸及密碼密鑰雙重驗證詳解
- CentOS 7.1添加刪除用戶的方法
- CentOS查找/掃描局域網(wǎng)打印機IP講解
- CentOS7使用hostapd實現(xiàn)無AP模式的詳解
- su命令不能切換root的解決方法
- 解決VMware下CentOS7網(wǎng)絡重啟出錯
- 解決Centos7雙系統(tǒng)后丟失windows啟動項
- CentOS下如何避免文件覆蓋
- CentOS7和CentOS6系統(tǒng)有什么不同呢
- Centos 6.6默認iptable規(guī)則詳解