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 :
Here is my code :
require_once 'Zend/Loader.php';

$user = '';
$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 = '' . $blogID . '/posts/default';
  $entry = $gdClient->newEntry();
  $entry->title = $gdClient->newTitle($title);
  $entry->content = $gdClient->newContent($content);

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

  return $newPostID; }

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 ?