开发者

query blogger posts with PHP, using search API

I'm using the BLogger API (goo开发者_如何学Cgle) 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!


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

EDIT: It's only for Javascript, apparently...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜