July 29, 2011
How to add tags/labels to bloggers posts via Gdata api
<?php
/*
Posted at technoslab.blogspot.com
How to post to blogger using PHP with labels/categories/tags using gData api ?
*/
function createPublishedPost($title, $content,$tags){
/* DEFINE THESE */
$user = 'BLOGGER_USERNAME';
$pass = 'BLOGGER_PASS';
$blogID = 'YOUR_BLOG_ID';
$service = 'blogger';
require_once'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
$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);
$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('html');
$tags = explode(",",$tags);
if(is_array($tags)){
$labels = array();
foreach($tags as $tag){
$labels[] = $gdClient->newCategory(trim($tag), 'http://www.blogger.com/atom/ns#');
}
/* Adding tags to post */
$entry->setCategory($labels);}
$createdPost = $gdClient->insertEntry($entry, $uri);
$idText = split('-', $createdPost->id->text);
$newPostID = $idText[2];
return $newPostID;
}
/* USAGE OF THIS FUNCTION */
createPublishedPost("Sample post title","I'm an a post the demonstrates usage of gdata api to publish articles to a blogspot blog.","sampletag1,sampletag2");
// tags must be passed to function as comma separated values.
?>
Dependency: http://framework.zend.com/download/gdata
Previous post on this: http://technoslab.blogspot.com/2011/04/posting-to-bloggercom-via-php.html
Subscribe to:
Post Comments (Atom)
Thank you for this example. After hours of searching it seems you are the only one in the world who has a working example on how to add labels to blogger post.
ReplyDeleteThank you very much.
Thanks a lot.
ReplyDeleteWhen we choose to do the opposite of nothing, then we can do something to help others and
ReplyDeletemake a difference. If you are unable to sign in to
Game Center or are having problems staying connected:.
You can only acquire a small amount of in-game money or gold,
and cannot participate in the auction house, send mail, join guilds, or even whisper to someone unless someone whispers to you first.
Feel free to surf to my blog - Customer-experience.ru
Major follows some sports, primarily during the playoffs.
ReplyDeleteThe player who spins the coin is referred to as the spinner.
Making your game play is the next phase you'll be focusing on.
Also visit my web page; cinemaextreme.blogspot.co.uk/2007/10/hairspray.html
Multiplayer versions is more exciting as in this, you'll be able to team up or even contend with other participants to defeat the enemies. they simply need to learn that you will not be able to appease everyone of your player-base. It is recommended that the golfers select those putters with which the golfers feel good and works well with their gaming pattern.
ReplyDeleteFeel free to visit my webpage :: please click the following internet site
But, internet radio offers a whole lot more
ReplyDeletethan just your favorite music online. We definitely
like it's simple, clean black styling, push-button central dial and nicely labeled front controls, and the way that stations have sounded as we. The banner ad may be placed on the same page listeners go to when they want to listen to the station on-line.
Feel free to visit my web-site - internetradio aussetzer
One of the other types of console where you can play this game
ReplyDeleteis the fighting online video game. With some game clients are growing,
web games will ensure players enjoy the same quality, and eventually catch up with the client
game in the image. 4) As people showed up to vote KEEP, they
were frequently branded "sockpuppets", banned, and their comments stricken from the discussion.
Here is my site ... spiele spielen
Camping first aid kits are different from the first aid kits you may have at home, as they will be stocked with supplies to treat
ReplyDeleteoutdoor injuries, such as snakebite, burns, sprains as well as animal and insect bites.
Once you decide what kind of Oregon coast camping vacation
you are looking for, finding an Oregon coast camping site is a piece
of cake. What I loved the most about these types of adventures was what
I could see.
Here is my page - click the up coming web site
With internet radio, you get pretty much what you want,
ReplyDeletewhen you want. Wi - Fi internet radio is a new
handy device for all music lovers of this world, which is a gift of the
technology to the entertainment world. You can see if any of your Facebook friends are listening
by clicking on the Facebook link on the bottom right.
Feel free to visit my blog post ... visit my webpage
The Nokia N8 provides an exciting alternative to
ReplyDeletesome of the mainstream Smartphones which are currently available.
If the horse is a good model and stands well during his photo op,
then work it. This often enables consumers to review each
camera individually to get all the details and find out what is
included with their purchase.
my web site Nikon digital Camera auctions
Wallace explained the importance of nature by explaining the relationship between the
ReplyDeleteMan and Nature. These are reaching thousands of people at a
time who recognize the self help benefits and pass them
on to friends who do the same and they become viral. So choose
the perfect Funny Family Poems to surprise your mother and
make it a special memory to always remember.
You don't need to take my word for this, you can read the reviews for yourself. This 12 megapixel camera is capable of capturing 3D photos too. The software is Sony's "Picture Motion Browser" v
ReplyDelete5.
my weblog: Read This method
They want to win by playing their very best as opposed
ReplyDeleteto winning by putting the other person off. This means to sell your mods would be considered
the same as pirating the game itself. In addition, you can save the effort
of coding the store functionality, virtual goods dependencies, billing interfaces and rewards.
my web site ... Learn Alot more Here
This idea would be perfectly done with camping, it allows a
ReplyDeletecamper to acquire the utmost relaxation which is the basic objective
of the activity. As one might have guessed, Si's little nap turns into an overnight stay at Phil and Kay's.
Even though most liquid fuel stoves are more powerful and provide great
heat output than canister stoves, they are not as convenient.
Here is my website Comments On: Get More Vacation For Your Money! Go Camping
It iis based on computer with electrographic sensor technology.
ReplyDeleteAt the same time, web games seemed like the future of gaming, and we
wanted to be a part of it. The main reason why you would want to do this is simple, you can unlock the true potential of your purchase.
my page http://www.akiba.net/index.php?document_srl=729&mid=twitter **
(Game scheduled for December 15th with Utah State playing Toledo).
ReplyDeleteIt is an adventurous game filled with fun and excitement.
Most video game testers reported that their salary falls between $15,000 and $55, 000 in a year.
Here is my website :: simply click the following website page
The internet is fueling the success of music because it can be listened to at any time
ReplyDeleteof the day and anywhere in the world. And once you have your own project
that you want to promote, you must have considered the radio as one of the best alternatives
to introduce your music to the crowds. You will need an outside antenna to get clear reception on your radio.
My site - Radio Philips ae 2730
Dominion: Intrigue is a standalone expansion for the award-winning Dominion card game that shook the gaming world in 2008.
ReplyDeleteBy obtaining increasingly more favour using their company people in your social settings,
the more handle you will need to acquire what you would like, and thru The particular Coalition Game you
have just about the most effective tips for hypnotherapy that gives you the talent to ensure that you influence
other folks. It sounds like you log into the game and join a "Shadow war" server and
play with hundreds of other players within that PVP world, but that world is different from the cooperative Arkfall boss hunting world.
Stop by my weblog ... Going in voice.mynewtestsite.
eu []
In other trick taking games, players can take tricks on a number of kind of contract.
ReplyDeleteLeveling up to defeat all the enemies can be
time arresting so apprehend to absorb a acceptable bulk of
hours anniversary day accepting the a lot
of out of this game. Moreover, there you could also play Scrabble in the
internet, TV game shows or game consoles.
my page ... spielespielen24.de
What is the most important portion is the sincere words that you put together in the poems that will catch the attention of the one you loved as this is what you truly want
ReplyDeletefrom the romantic poems that you have created for him.
Love poems intensify the feeling of love in the minds of lovers.
So choose the perfect Funny Family Poems to surprise your mother
and make it a special memory to always remember.
my blog :: poems
Even though your goal is just to lose 5 pounds in a week,
ReplyDeleteyou should be strict with what you do so as not to inadvertently undo all your hard work for vegetarian
weight loss. Anyone who dares to make a closer
inspection will find the underlying difference. The institution
has persistently offered ideal programs and services for those struggling to achieve certain levels of body weight.
My blog post - visit the next site :: http://www.myunfinishedbusiness.com/index.php/member/25319 ::
Once you have the centers prepared, there are a number of ways to decorate the outside.
ReplyDeleteIf you prefer to use frozen strawberries, they work in this cake equally as well as
the fresh. The TV crew will embark on the task of
helping "sweet" businesses survive and prosper.
my weblog :: diaper cake accessories ()
clients, Rachel, who got back together with
ReplyDeleteher ex. At the same time, web games seemed like the future of gaming, and we wanted to be
a part of it. Preparing to apply to the dozens of other game development companies for video game jobs will enable you to expand and diversify your list of possible employers, and your chances of getting hired will increase tremendously.
my webpage :: university of colorado :: ::
Wallace explained the importance of nature by explaining the relationship between the Man and Nature.
ReplyDeleteFrom ancient Britain come romantic love poems ** of forbiddin trysts in black forests
and aristocratic romance between knights and fair maidens.
On the other hand children spend most of their time with their mothers, who love deeply, scold harshly,
they worry extremely but in the end they make you what you are.
Hey there! I've been reading your web site for a long time now and finally got the courage to go ahead and give you a shout out from Atascocita Texas! Just wanted to mention keep up the good job!
ReplyDeletehttp://gamersadda.org/index.php?do=/blog/125461/raspberry-ketone-reviews/
my web site raspberry ketone review
I wanted to thank you for this good read!! I certainly enjoyed
ReplyDeleteevery bit of it. I've got you book-marked to look at new stuff you post…
Here is my site :: cidp
Following, the rectus abdominus displaced the a mnemotechnical.
ReplyDeleteAbs after pregnancy can be too to be your master tread-wheel physical exertion for free weight loss,
support these three tonalities in mind. We experience all for most men
to physique muscle; let lonely abs women. Wash the orbs of
your feet as much as possible.
My web blog - truth about abs - http://truthaboutabsdon.
com ()
I for all time emailed this blog post page to all my
ReplyDeleteassociates, because if like to read it next my friends will too.
Feel free to visit my web blog :: sawmilling
In other trick taking games, players can take tricks on a number of kind of contract.
ReplyDeleteLeveling up to defeat all the enemies can be time arresting so apprehend
to absorb a acceptable bulk of hours anniversary day
accepting the a lot of out of this game. It sounds
like you log into the game and join a "Shadow war" server and play with
hundreds of other players within that PVP world,
but that world is different from the cooperative Arkfall boss hunting world.
my page sub zero ()
Music streaming on the Internet is usually referred to as webcasting since it is not transmitted broadly through wireless means.
ReplyDeleteHollywood 27 is first and foremost a film company, but recently it has ventured into broadcasting music
of various genres via the popular platform Live365.
There are sophisticated Wi-fi Internet radios available now, which are available complete with
speakers, are portable and do not require a computer.
My blog post - internetradio aufnehmen **