Services_Blogging
[ class tree: Services_Blogging ] [ index: Services_Blogging ] [ all elements ]

Source for file blogger.php

Documentation is available at blogger.php

  1. <?php
  2.  
  3. /* Example that adds a post to a blogger.com blog */
  4.  
  5. /* Include our class */
  6. require_once("Services/RPCBlogging.php");
  7.  
  8. $api = RPCBlogging::BLOGGER;        // Currently either "Blogger" or "metaWeblog"
  9. $user "youruserid";       // Put your blog account's username here 
  10. $pass "yourpassword";     // Put your blog account's password here 
  11.  
  12. /* The path to the server RPC script. This will
  13.  * usually be specified by your blog software/host.
  14.  * eg) "/api/RPC2" for blogger.com accounts
  15.  */
  16. $path "/rpc/api.php";
  17.  
  18. /* The URI of the blog server. Also should provided by the blog software/host
  19.  * that you use.
  20.  * eg) "plant.blogger.com" for blogger.com accounts
  21.  */ 
  22. $address "host.example.com";
  23.  
  24. /* Instantiate our class */
  25. $blogger = RPCBlogging::factory($api$user$pass$path$address);
  26.  
  27. $myBlogs $blogger->getBlogs()// Get an array of our blogs
  28. print_r($myBlogs);               // Note the structure of how the list of blogs is returned
  29.  
  30. /* Create a new post */
  31. $newPost = new RPCBlogging_Post();
  32.  
  33. /* The blogger API supports only one field, the content */
  34. $newPost->setContent("This is a test post. Hopefully iy should appear on my
  35. blog, if all goes well!");
  36.  
  37. /* Actually add the post to the your first blog that is published immediately */
  38. $addPost $blogger->newPost($myBlogs[0]["blogid"]true$newPost);
  39. print_r($addPost);              //See that the PostID is returned
  40.  
  41. /* That's it! Try out the other methods, Have fun! */
  42.  
  43. ?>

Documentation generated on Mon, 11 Mar 2019 15:46:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.