0
我想使用下面的代碼發佈到我的博客帳戶,但它似乎不工作。我是這個新手,我錯過了什麼?謝謝... `使用Zend Gdata發佈到博客
<?php
$user = '[email protected]';
$pass = 'password';
// I have to admit, I would normally use the autoloader
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 createPublishedPost()
{
$title='Hello, world!';
$content='I am blogging on the internet.';
$blogID= "4419618066922958909";
$uri = 'http://www.blogger.com/feeds/' . $blogID . '/posts/default';
$entry = $gdClient->newEntry();
$entry->title = $gdClient->newTitle($title);
$entry->content = $gdClient->newContent($content);
$entry->content->setType('text');
$createdPost = $gdClient->insertEntry($entry, $uri);
$idText = split('-', $createdPost->id->text);
$newPostID = $idText[2];
return $newPostID;
}
$ret = createPublishedPost();
echo $ret;
?>
`
嘗試了你的代碼...我得到錯誤500 ..我已經測試了單獨的身份驗證,它工作正常..與創建職位的功能我猜 – 2011-04-27 08:13:41
另一件好事:檢查發送到insertEntry的uri。 – rzetterberg 2011-04-27 08:21:32