查询用PHP博客帖子,使用搜索API [英] query blogger posts with PHP, using search API

查看:181
本文介绍了查询用PHP博客帖子,使用搜索API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using the BLogger API (google) to try and search for certain strings (i.e.'John Doe is my friend' - and return the blog id/url/etc) on public blogs. All I have found until now returns only data for my own account, not all public accounts.

这是我现在有,它不会输出就像我没有博客建立自己。我已经尝试添加参数,这样来缩小搜索范围,但我觉得在$查询将需要改变一下。

Here's what I have now, it doesn't output much as I have no blogs set up myself. I've tried adding parameters and such to narrow down the search, but I feel the $query will need to change a bit.

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

?>

我想这不应该是太疯狂了......只是还没有找到一个解决办法。谢谢!

I figure this shouldn't be too crazy...just haven't found a solution yet. Thanks!

推荐答案

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

You say you're using the Blogger API, but for searching blogs you should use the Blog Search API, i think.

编辑:这是唯一为Javascript,显然...

It's only for Javascript, apparently...

这篇关于查询用PHP博客帖子,使用搜索API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆