boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pinging Technorati

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
bluviolin



Joined: 31 Dec 2003
Posts: 1
Location: Italy

PostPosted: Wed Dec 31, 2003 12:12 pm    Post subject: Pinging Technorati Reply with quote

This hack allows you to ping the Technorati aggregator when you update your weblog.

Insert this function in the b2-include/b2functions.php file or in an external included file:
Code:

function pingTechnorati($blog_ID = 1)
{
   global $use_technoratiping, $blogname,$siteurl,$blogfilename;
   if ((!(($blogname=="my weblog") && ($siteurl=="http://example.com") && ($blogfilename=="b2.php"))) &&
   (!preg_match("/localhost//",$siteurl)) && ($use_technoratiping))
   {
      $client = new xmlrpc_client("/rpc/ping", "rpc.technorati.com", 80);
      $message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($blogname),
                                                           new xmlrpcval($siteurl."/")));
      $result = $client->send($message);
      if (!$result || $result->faultCode())
         return(false);

      return(true);
   }
   else
      return(false);
}

Then, In the b2config.php file set the $use_technoratiping variable:
Code:
$use_technoratiping = 1;

Finally, modify the 'post' case in the b2edit.php file:
Code:

   pingWeblogs($blog_ID);
   pingCafelog($cafelogID, $post_title, $post_ID);
   pingBlogs($blog_ID);
   pingTechnorati($blog_ID); /* <--- ADD THIS LINE   */


These instrucion are also available in the Technorati developers Wiki and, in Italian, on my Web site.
Back to top
View user's profile Send private message Visit poster's website
Cyberian75



Joined: 26 Sep 2002
Posts: 1004
Location: Washington

PostPosted: Thu Jan 01, 2004 9:42 pm    Post subject: Reply with quote

Thanks for the function. Smile I found an error, though.

The line...

Code:

(!preg_match("/localhost//",$siteurl)) && ($use_technoratiping))


should be

Code:

(!preg_match("/localhost/",$siteurl)) && ($use_technoratiping))

_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group