List Info

Thread: Re: Trouble Using Zend Gdata PHP Class




Re: Trouble Using Zend Gdata PHP Class
country flaguser name
Germany
2007-02-08 04:16:47
Hi,
bevore you can start reading your entrys, you have to
authenticate
yourself.

require_once 'Zend/Gdata/ClientLogin.php';

$client = Zend_Gdata_ClientLogin::getHttpClient($email,
$passwd,
'cl');
$gdataBlog = new Zend_Gdata_Blogger($client);

in this case the third argument 'cl' means u are trying to
connect to
your
Google Calendar. Rignt now im not sure, whats the blogs
string (maybe
'bg')..

Enix

On 9 Jan., 23:38, "sbgamesc...gmail.com"
<sbgamesc...gmail.com>
wrote:
> I downloaded theZendGdataPHP Class and looked over the
demos and the
> included class files. There are built in demos for Base
andCalendar
> using both ClientLogin and AuthSub. I started modifying
theCalendar
> demo to be a Blogger demo and used the documentation
> (http://framework.zend.com/manual/en/zend.gdata.blogge
r.html) and class
> definitions as a guide, but am coming up short.
>
> I am trying to get posts or a list of blogs from the
"old" Blogger and
> this is what I get:
>
> Fatal error: Uncaught exception 'Zend_Feed_Exception'
with message
> 'Feed failed to load, got response code 404' in
> /sandbox/gdata/library/Zend/Feed.php:186
> Stack trace:
> #0 /sandbox/gdata/library/Zend/Gdata.php(106):
> Zend_Feed::import('http://xxxxxx.b...')
> #1 /sandbox/gdata/library/Zend/Gdata/Blogger.php(56):
> Zend_Gdata->getFeed('http://xxxxxx.b...')
> #2
/sandbox/gdata/demos/Zend/Gdata/Blogger-ClientLogin-2.php(92
):
> Zend_Gdata_Blogger->getBloggerFeed('xxxxxx')
> #3  thrown in
/sandbox/gdata/library/Zend/Feed.php on line 186
>
> xxxxxx represents the name of the blog I am trying to
get a listing
> for.
>
> Here is the code:
>
> <?php
> /**
>  *ZendFramework
>  *
>  * LICENSE
>  *
>  * This source file is subject to the new BSD license
that is bundled
>  * with this package in the file LICENSE.txt.
>  * It is also available through the world-wide-web at
this URL:
>  *http://fram
ework.zend.com/license/new-bsd
>  * If you did not receive a copy of the license and are
unable to
>  * obtain it through the world-wide-web, please send an
email
>  * to lice...zend.com so we can send you a copy
immediately.
>  *
>  * category  Zend
>  * package    Zend
>  * copyright  Copyright (c) 2006ZendTechnologies USA
Inc.
> (http://www.zend.com)
>  * license    http://fram
ework.zend.com/license/new-bsd    New BSD
> License
>  */
>
> /**
>  * Demonstrating Zend_Gdata for reading and writing
Google Blogger
>  * using ClientLogin authentication.
>  */
>
> $D = DIRECTORY_SEPARATOR;
> set_include_path(
>     dirname(__FILE__) .
"{$D}..{$D}..{$D}..{$D}library"
>     . PATH_SEPARATOR . get_include_path());
>
> require_once 'Zend.php';
> require_once 'Zend/Gdata/Blogger.php';
> require_once 'Zend/Gdata/ClientLogin.php';
>
> /**
>  * Enter your Google account credential here
>  */
> $email = 'xxxxxx';
> $passwd = 'xxxxxx';
> if ($passwd == 'xxxxxxxx') {
>     echo "<h1>Configuration
incomplete</h1>n";
>     echo "<p>You need to edit the script for
this demo and enter your
> Google account credentials to make this demo
work.</p>n";
>     exit();
>
> }
>
> /**
>  * Enter your blog information
>  */
> $myBlog = "xxxxxx";
>
> /**
>  * Filter php_self to avoid a security vulnerability.
>  */
> $php_self = htmlentities(substr($_SERVER['PHP_SELF'],
0,
> strcspn($_SERVER['PHP_SELF'], "nr")),
ENT_QUOTES);
>
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
> <html xmlns="http://www.w3.
org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"
> />
> <title>Google Blogger Demo</title>
> <style>
> body{ font-family: Arial; }
> </style>
> </head>
> <body>
> <table border="1">
> <tr>
> <td valign="top">
> <?php
> /**
>  * Get the blog feed.
>  */
> $gdataBlog = new Zend_Gdata_Blogger();
>
> // One way to get a feed for a blog...
> $feed = $gdataBlog->getBloggerFeed($myBlog);
> $feed_title = $feed->title();
> ?>
>     <h3><?= $feed_title ?></h3>
> <?php
> foreach ($feed as $item) {
> ?>
>     <p><?= $item->title() ?>
>
> <?php
>     $action = $php_self;
>     $value = htmlentities($item->saveXML());
>     /**
>      * Rename the title.
>      */
>     $item->title = $feed_title . ": " .
$item->title();
> ?>
>
>     <form method="POST"
action="<?= $action ?>">
>     <input type="hidden"
name="save" value="<?= $value
?>">
>     <input type="submit"
value="Copy">
>     </form>
>     </p>
> <?php}
>
> ?>
>
> </td>
> <td valign="top">
> <?php
> /**
>  * Get the blog feed list
>  */
> $authenticatedHttpClient =
> Zend_Gdata_ClientLogin::getHttpClient($email, $passwd,
'cl');
> $gdataBlog = new
Zend_Gdata_Blogger($authenticatedHttpClient);
> $myBlogs = $gdataBlog->getBloggerListFeed();
> $feed = $gdataBlog->getBloggerFeed($myBlog);
> $feed_title = $feed->title();
> ?>
>     <h3><?= $feed_title ?></h3>
> <?php
> foreach ($feed as $item) {
> ?>
>     <p><?= $item->title() ?>
>
> <?php
>     $action = $php_self;
>     $value = htmlentities($item->saveXML());
>     /**
>      * Rename the title.
>      */
>     $item->title = $feed_title . ": " .
$item->title();
> ?>
>
>     <form method="POST"
action="<?= $action ?>">
>     <input type="hidden"
name="save" value="<?= $value
?>">
>     <input type="submit"
value="Copy">
>     </form>
>     </p>
> <?php}
>
> ?>
>
> </td>
> </tr>
> </table>
> </body>
> </html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Blogger Data API" group.
To post to this group, send email to bloggerDevgooglegroups.com
To unsubscribe from this group, send email to
bloggerDev-unsubscribegooglegroups.com
For more options, visit this group at 
http://groups-beta.google.com/group/bloggerDev?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Trouble Using Zend Gdata PHP Class
user name
2007-02-08 10:53:49
On 2/8/07, dj.enixgooglemail.com <dj.enixgooglemail.com> wrote:
>
> Hi,
> bevore you can start reading your entrys, you have to
authenticate
> yourself.
>
> require_once 'Zend/Gdata/ClientLogin.php';
>
> $client = Zend_Gdata_ClientLogin::getHttpClient($email,
$passwd,
> 'cl');
> $gdataBlog = new Zend_Gdata_Blogger($client);
>
> in this case the third argument 'cl' means u are trying
to connect to
> your
> Google Calendar. Rignt now im not sure, whats the blogs
string (maybe
> 'bg')..

To get a token for Blogger, use 'blogger' instead of 'cl'

-- Pete


> On 9 Jan., 23:38, "sbgamesc...gmail.com" <sbgamesc...gmail.com>
> wrote:
> > I downloaded theZendGdataPHP Class and looked over
the demos and the
> > included class files. There are built in demos for
Base andCalendar
> > using both ClientLogin and AuthSub. I started
modifying theCalendar
> > demo to be a Blogger demo and used the
documentation
> > (http://framework.zend.com/manual/en/zend.gdata.blogge
r.html) and class
> > definitions as a guide, but am coming up short.
> >
> > I am trying to get posts or a list of blogs from
the "old" Blogger and
> > this is what I get:
> >
> > Fatal error: Uncaught exception
'Zend_Feed_Exception' with message
> > 'Feed failed to load, got response code 404' in
> > /sandbox/gdata/library/Zend/Feed.php:186
> > Stack trace:
> > #0 /sandbox/gdata/library/Zend/Gdata.php(106):
> > Zend_Feed::import('http://xxxxxx.b...')
> > #1
/sandbox/gdata/library/Zend/Gdata/Blogger.php(56):
> > Zend_Gdata->getFeed('http://xxxxxx.b...')
> > #2
/sandbox/gdata/demos/Zend/Gdata/Blogger-ClientLogin-2.php(92
):
> > Zend_Gdata_Blogger->getBloggerFeed('xxxxxx')
> > #3  thrown in
/sandbox/gdata/library/Zend/Feed.php on line 186
> >
> > xxxxxx represents the name of the blog I am trying
to get a listing
> > for.
> >
> > Here is the code:
> >
> > <?php
> > /**
> >  *ZendFramework
> >  *
> >  * LICENSE
> >  *
> >  * This source file is subject to the new BSD
license that is bundled
> >  * with this package in the file LICENSE.txt.
> >  * It is also available through the world-wide-web
at this URL:
> >  *http://fram
ework.zend.com/license/new-bsd
> >  * If you did not receive a copy of the license
and are unable to
> >  * obtain it through the world-wide-web, please
send an email
> >  * to lice...zend.com so we can send you a copy
immediately.
> >  *
> >  * category  Zend
> >  * package    Zend
> >  * copyright  Copyright (c)
2006ZendTechnologies USA Inc.
> > (http://www.zend.com)
> >  * license    http://fram
ework.zend.com/license/new-bsd    New BSD
> > License
> >  */
> >
> > /**
> >  * Demonstrating Zend_Gdata for reading and
writing Google Blogger
> >  * using ClientLogin authentication.
> >  */
> >
> > $D = DIRECTORY_SEPARATOR;
> > set_include_path(
> >     dirname(__FILE__) .
"{$D}..{$D}..{$D}..{$D}library"
> >     . PATH_SEPARATOR . get_include_path());
> >
> > require_once 'Zend.php';
> > require_once 'Zend/Gdata/Blogger.php';
> > require_once 'Zend/Gdata/ClientLogin.php';
> >
> > /**
> >  * Enter your Google account credential here
> >  */
> > $email = 'xxxxxx';
> > $passwd = 'xxxxxx';
> > if ($passwd == 'xxxxxxxx') {
> >     echo "<h1>Configuration
incomplete</h1>n";
> >     echo "<p>You need to edit the
script for this demo and enter your
> > Google account credentials to make this demo
work.</p>n";
> >     exit();
> >
> > }
> >
> > /**
> >  * Enter your blog information
> >  */
> > $myBlog = "xxxxxx";
> >
> > /**
> >  * Filter php_self to avoid a security
vulnerability.
> >  */
> > $php_self =
htmlentities(substr($_SERVER['PHP_SELF'], 0,
> > strcspn($_SERVER['PHP_SELF'], "nr")),
ENT_QUOTES);
> >
> > ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.0 Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transiti
onal.dtd">
> > <html xmlns="http://www.w3.
org/1999/xhtml">
> > <head>
> > <meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"
> > />
> > <title>Google Blogger Demo</title>
> > <style>
> > body{ font-family: Arial; }
> > </style>
> > </head>
> > <body>
> > <table border="1">
> > <tr>
> > <td valign="top">
> > <?php
> > /**
> >  * Get the blog feed.
> >  */
> > $gdataBlog = new Zend_Gdata_Blogger();
> >
> > // One way to get a feed for a blog...
> > $feed = $gdataBlog->getBloggerFeed($myBlog);
> > $feed_title = $feed->title();
> > ?>
> >     <h3><?= $feed_title ?></h3>
> > <?php
> > foreach ($feed as $item) {
> > ?>
> >     <p><?= $item->title() ?>
> >
> > <?php
> >     $action = $php_self;
> >     $value = htmlentities($item->saveXML());
> >     /**
> >      * Rename the title.
> >      */
> >     $item->title = $feed_title . ": "
. $item->title();
> > ?>
> >
> >     <form method="POST"
action="<?= $action ?>">
> >     <input type="hidden"
name="save" value="<?= $value
?>">
> >     <input type="submit"
value="Copy">
> >     </form>
> >     </p>
> > <?php}
> >
> > ?>
> >
> > </td>
> > <td valign="top">
> > <?php
> > /**
> >  * Get the blog feed list
> >  */
> > $authenticatedHttpClient =
> > Zend_Gdata_ClientLogin::getHttpClient($email,
$passwd, 'cl');
> > $gdataBlog = new
Zend_Gdata_Blogger($authenticatedHttpClient);
> > $myBlogs = $gdataBlog->getBloggerListFeed();
> > $feed = $gdataBlog->getBloggerFeed($myBlog);
> > $feed_title = $feed->title();
> > ?>
> >     <h3><?= $feed_title ?></h3>
> > <?php
> > foreach ($feed as $item) {
> > ?>
> >     <p><?= $item->title() ?>
> >
> > <?php
> >     $action = $php_self;
> >     $value = htmlentities($item->saveXML());
> >     /**
> >      * Rename the title.
> >      */
> >     $item->title = $feed_title . ": "
. $item->title();
> > ?>
> >
> >     <form method="POST"
action="<?= $action ?>">
> >     <input type="hidden"
name="save" value="<?= $value
?>">
> >     <input type="submit"
value="Copy">
> >     </form>
> >     </p>
> > <?php}
> >
> > ?>
> >
> > </td>
> > </tr>
> > </table>
> > </body>
> > </html>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Blogger Data API" group.
To post to this group, send email to bloggerDevgooglegroups.com
To unsubscribe from this group, send email to
bloggerDev-unsubscribegooglegroups.com
For more options, visit this group at 
http://groups-beta.google.com/group/bloggerDev?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )