Posting to Blogger using PHP

6:49:00 PM | ,

I'm having a problem getting the Blogger API for PHP to work.
What I need is to be able to post a new blogpost to my bloggeraccount. The code I'm using is taken from the Google API page here :http://code.google.com/intl/nl/apis/blogger/docs/1.0/developers%5Fguide%5Fphp.html
Here is my code :
<?
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

$user = 'name@example.com';
$pass = 'password';
$service = 'blogger';

$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, null,
        Zend_Gdata_ClientLogin::DEFAULT_SOURCE, null, null, 
        Zend_Gdata_ClientLogin::CLIENTLOGIN_URI, 'GOOGLE');
$gdClient = new Zend_Gdata($client); 

$blogID = '7973737751295446679';
function createPublishedPost($title='Hello, world!', $content='I am blogging on the internet.')
{
  $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; }

createPublishedPost();
?>
The error I'm getting is 'Fatal error: Call to a member function newEntry() on a non-object in C:\xampp\htdocs\HelloWorld\blogger2.php on line 21'
Can anyone help me out or give me a working code sample of how to post to blogger using PHP ?