使用搜索API使用PHP查询博客帖子
我正在使用BloggerAPI(谷歌)尝试在公共博客上搜索某些字符串(即“John Doe是我的朋友”,并返回博客id/url/etc)。到目前为止,我所找到的只是返回我自己帐户的数据,而不是所有公共帐户的数据 这是我现在拥有的,它没有输出太多,因为我自己没有设置博客。我已经尝试添加参数等来缩小搜索范围,但我觉得$query需要做一些更改使用搜索API使用PHP查询博客帖子,php,api,blogger,Php,Api,Blogger,我正在使用BloggerAPI(谷歌)尝试在公共博客上搜索某些字符串(即“John Doe是我的朋友”,并返回博客id/url/etc)。到目前为止,我所找到的只是返回我自己帐户的数据,而不是所有公共帐户的数据 这是我现在拥有的,它没有输出太多,因为我自己没有设置博客。我已经尝试添加参数等来缩小搜索范围,但我觉得$query需要做一些更改 <?php $user = 'xxxxxx'; $pass = 'xxxxxx'; require_once 'Zend/Loader.php';
<?php
$user = 'xxxxxx';
$pass = 'xxxxxx';
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Feed');
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, 'blogger', null,
Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null,
Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client);
function printAllBlogs(){
$query = new Zend_Gdata_Query('http://www.blogger.com/feeds/default/blogs');
$feed = $gdClient->getFeed($query);
printFeed($feed);
}
function printFeed($feed){
$i = 0;
foreach($feed->entries as $entry) {
print $i ." ". $entry->title->text . "\n";
$i++;
}
}
?>
我觉得这不应该太疯狂…只是还没有找到解决办法。谢谢 你说你在使用Blogger API,但我认为搜索博客应该使用
编辑:很显然,这只适用于Javascript…你说你正在使用Blogger API,但我认为,搜索博客时你应该使用
编辑:这只适用于Javascript,显然…很酷,这就可以了!非常感谢。很酷,这真的可以!非常感谢。