1

我正在使用 BLogger API (google) 尝试在公共博客上搜索某些字符串(即“John Doe 是我的朋友” - 并返回博客 id/url/等)。到目前为止,我发现的所有数据仅返回我自己帐户的数据,而不是所有公共帐户的数据。

这就是我现在所拥有的,它没有输出太多,因为我自己没有设置博客。我已经尝试添加参数等来缩小搜索范围,但我觉得 $query 需要进行一些更改。

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

?>

我认为这不应该太疯狂......只是还没有找到解决方案。谢谢!

4

1 回答 1

1

您说您正在使用 Blogger API,但我认为对于搜索博客,您应该使用Blog Search API

编辑:它只适用于Javascript,显然......

于 2010-11-15T21:46:01.023 回答