juust ~ php oddities

Unordered list of one element
  • rss
  • begin
  • about
    • vcard
    • WTF is BroJesus
  • php scripts
    • flickr wp widget
    • google multi key serp tool, php script
    • gwt plugin
  • php classes
    • php pagerank class
    • fibonacci class
    • robots.txt parser php class
  • serp
    • serp dashboard wordpress plugin
  • services

p2p with wordpress xml-rpc

juust | 08/02/2010

Simple fun with Wordpress xml-rpc. I want a way to return a welcome message to interested blog owners.

To get that done, I make a new plugin that adds a new method to the xml-rpc server.

The method ‘p2p.welcome’ is mapped to the plugin function ‘p2p_welcome’, which returns the “about yourself” description of the admin profile.

  1. /*
  2. Plugin Name: P2P rpc
  3. Description: RPC Peer to Peer stuff
  4. Version: 1.0.0  
  5. Author: Juust
  6. Author URI: http://www.juust.org/
  7. */
  8.  
  9. /* xmlrpc_methods hooks into IXR_Server */    
  10. add_filter( 'xmlrpc_methods', 'p2p_xmlrpc_methods' );
  11.  
  12. /* pass the $methods array and add a new one */    
  13. function p2p_xmlrpc_methods( $methods ) {
  14.      $methods['p2p.whoami'] = 'p2p_whoami';
  15.      return $methods;
  16. }
  17.  
  18. /* the function that returns the profile description of user 1 (admin) */    
  19. function p2p_whoami() {
  20.  return get_the_author_meta( 'user_description', 1 );
  21. }

I plug that into the wordpress blog.

Then I can make a small test program :

  • include class-IXR.php which has the IXR_Client class
  • extend IXR_Client as P2PClient
  • add a function P2PClient->whoareyou()
  • …that calls the new method p2p.whoami on the blog
  • echo the returned data : the admin profile description
  1. include_once('/absolute/path/to/class-IXR.php');
  2.  
  3. Class P2PClient extends IXR_Client {
  4.  
  5. var $MyPeerConnection;
  6. var $response;
  7. var $url;
  8.  
  9. function __construct($url="") {
  10.                  $this->url = $url;
  11.     if(!$this->connect($url)) return false;
  12.      }
  13.      
  14. //see if there is an xml rpc endpoint
  15. function connect($url)
  16.      {
  17.        if(!$this->MyPeerConnection = new IXR_Client($this->url)) return false;
  18.      }
  19.  
  20.  //query 'p2p.whoami', store the response
  21. function whoareyou() {
  22.   $this->MyPeerConnection->query('p2p.whoami');
  23.   $this->response = $this->MyPeerConnection->getResponse();
  24.      }
  25. }
  26.  
  27. //init the client, query, echo response
  28. $p2p = new P2PClient('http://loaneys.com/xmlrpc.php');
  29. $p2p->whoareyou();
  30. echo "resp ". $p2p->response;

That returns :

Hi I am juust, admin of loaneys.com. I worked as business economist at project control and proces automation in engineering and utilities. These days, I do some scripting as a hobby and stick to painting as job.

That is a basic way to exchange blog data by extending the xml-rpc endpoint.

Comments
No Comments »
Categories
wordpress, xml-rpc
Comments rss Comments rss
Trackback Trackback

Tweets on Google’s frontpage

juust | 24/01/2010

The article about using Yahoo Pipes for Twitter ammo deserves an update. When I wrote it (june 2009), Google had not announced they would be listing Tweets on their frontpage.

I was curious if Google list tweets from an pipes account. The specific pipe does use Google News and other trusted news sources for it’s feed, so Tweets should rank high in relevance to the keyword, but I wasn’t sure Google allow automated accounts to hit the frontpage in Search.

I typed in “microfinance twitter” at Google Search and got this as result :

microfinance

There she is : @NeoFinance, one of my accounts that runs on a Yahoo Pipe.

The account itself is small, 750 tweets, it follows 60 accounts, and has 125 followers, mostly microfinance related. No automated following scripts, just the pipe. I had it offline for a few weeks but restarted it last week.

neofinance

Google do seem to consider Pipes-accounts acceptable.

Comments
No Comments »
Categories
google, seo
Comments rss Comments rss
Trackback Trackback

happy new year

juust | 31/12/2009

happy new year!

We do that every year, a dive in the north sea.

Comments
1 Comment »
Categories
juust
Comments rss Comments rss
Trackback Trackback

« Previous Entries Next Entries »

Recent Posts

  • geert wilders
  • gone till september
  • socialize me
  • Pagerank sculpting session
  • wish you were here

click me!
follow me






interesting sites

  • digitalpoint forums
  • seo underworld
  • hackspc
  • scripture4all.org

rss
Comments rss
Blog Directory
Web Developement Blogs - BlogCatalog Blog Directory
Listed in LS Blogs the Blog Directory and Blog Search Engine
Blog Flux Directory
joopita.com free web directory and search engine
design by jide
sitemap
22258 confirmed spam kills