2010-11-15 92 views
1

我使用Blogger API(谷歌),试图搜索特定字符串(ie'John李四是我的朋友” - 并返回博客ID/URL /等)上公共博客。直到现在我发现的所有数据仅为我自己的帐户返回,而不是所有的公共帐户。查询博客作者发布使用PHP,使用搜索API

这是我现在有,它不输出就像我没有博客建立自己。我试过添加参数等来缩小搜索范围,但是我觉得$查询需要稍微改变。

<?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++; 
    } 
} 

?> 

我觉得这不应该太疯狂了...还没有找到解决方案。谢谢!

回答

1

你说你正在使用Blogger的API,但是对于搜索博客,你应该使用Blog Search API,我想。

编辑:它只为Javascript,显然...

+0

很酷,这将实际上做!谢谢一堆。 – 2010-11-16 18:31:45