3 messages in com.googlegroups.bloggerdevRe: php api labels problem
FromSent OnAttachments
titzu29 Oct 2007 08:46 
Jeff Scudder31 Oct 2007 10:06 
titzu07 Nov 2007 05:02 
Subject:Re: php api labels problem
From:Jeff Scudder (j.@google.com)
Date:10/31/2007 10:06:40 AM
List:com.googlegroups.bloggerdev

On Oct 29, 8:46 am, titzu <ct.@internetexpert.ro> wrote:

Hi, I am trying to make a sctipt to post to blogger using PHP Blogger Data API. Onhttp://code.google.com/apis/blogger/developers_guide_php.htmlthere are some example functions in order to use GData api. one is: function createPublishedPost($title, $content) { global $blogID; global $gdClient; $cat="test";

$uri = 'http://www.blogger.com/feeds/'. $blogID . '/posts/ default'; $entry = $gdClient->newEntry(); $entry->title = $gdClient->newTitle($title); $entry->content = $gdClient->newContent($content);

$entry->category = $gdClient->newCategory($cat); //this is my code

$entry->content->setType('text'); $createdPost = $gdClient->insertEntry($entry, $uri); $idText = split('-', $createdPost->id->text); $newPostID = $idText[2];

return $newPostID;

}

I tryed to use $entry->category = $gdClient->newCategory($cat); but I get this error "Fatal error: Call to a member function getDOM() on a non-object in ............www\Zend\Gdata\App\FeedEntryParent.php on line 173"

please help

I saw a couple of small changes that you could make that should fix this. You set the category using this line:

$entry->category = $gdClient->newCategory($cat); //this is my code

But an entry contains an array of categories, not just one. So you might want to change this to something like this:

$label = $gdClient->newCategory('testlabel', 'http://www.blogger.com/ atom/ns#'); $entry->setCategory(array(0 => $label));

Note that I've added a scheme argument to the category which is required for Blogger comments. Please let me know how it goes :)

Happy coding,

Jeff