Dave Carabetta Blog Banner


December 10, 2005

I Added IceRocket Ping Support To BlogCFC


I have gone ahead and added ping support to BlogCFC for IceRocket.com. For those who have never used (or heard of) their site, it's funded by Mark Cuban and it does a great job of searching blogs. I call it the "Google of blog searching," as I tend to find their results a bit more on target than the other engines. I will be sending the code to Ray for consideration for the next release of BlogCFC, but if you want it now, here's what you need:

1) The new pingIceRocket() method:

<!---
   This function written by Dave Carabetta, www.cbetta.com/blog/
--->

<cffunction name="pingIceRocket" output="true" returnType="boolean" access="public"
   hint="Ping IceRocket.com to add blog to IceRocket high-priority indexing queue">

   <cfset var pingData = "" />
   <cfset var pingDataLen = "" />
   <cfset var isOK = false />
   <cfset var iceRocketResponse = "" />
   <cfset var pingResultString = "" />
   
   <cfoutput>
      <cfsavecontent variable="pingData">
      <?xml version="1.0" encoding="utf-8"?>
      <methodCall>
         <methodName>ping</methodName>
         <params>
            <param>
               <value>
                  <string>#instance.blogURL#</string>
               </value>
            </param>
         </params>
      </methodCall>
      </cfsavecontent>
   </cfoutput>
      <cfset pingData = trim(pingData) />
   <cfset pingDataLen = len(pingData) />
   
   <cfhttp method="post" url="http://rpc.icerocket.com/" port="10080" timeout="20" throwonerror="false">
    <cfhttpparam type="HEADER" name="User_Agent" value="BlogCFC" />
    <cfhttpparam type="HEADER" name="Host" value="#cgi.http_host#" />
    <cfhttpparam type="HEADER" name="Content-Type" value="text/xml" />
    <cfhttpparam type="HEADER" name="Content-Length" value="#pingDataLen#" />
   
    <cfhttpparam type="XML" value="#pingData#" />
   </cfhttp>
   
   <!--- Create an XML object using the RPC result string --->
   <cfset iceRocketResponse = xmlParse(cfhttp.fileContent) />
   <!--- Set the response string to a local variable for cleaner access --->
   <cfset pingResultString = iceRocketResponse.methodResponse.params.param.value.string.xmlText />
   
   <!--- Check the status code and the XML packet's method response to make sure things worked --->
   <cfif not compare(cfhttp.statuscode, "200 OK") and not compare(pingResultString, "Thanks for ping")>
    <cfset isOK = true />
   </cfif>
   
   <cfreturn isOK />
</cffunction>

2) Tweak the pingAggregators() method to look for the @icerocket directive:

<cfif aURL is "@technorati">
   <cfset pingTechnorati()>
<cfelseif aURL is "@weblogs">
   <cfset pingweblogs()>
<cfelseif aURL is "@icerocket">
   <cfset pingIceRocket()>
<cfelse>
   <cfhttp url="#aURL#" method="GET" resolveurl="false">
</cfif>

3) Add @icerocket to the pingurls line in the blog.ini file.

Refresh the application scope and you'll be good to go.



Comments
Blake Rhodes's Gravatar Thanks for adding IceRocket.com

Blake
# Posted By Blake Rhodes on 12/10/05 at 3:46 PM
Rob Gonda's Gravatar nice one Dave.

I never heard of icerocket, but I'll start using it now.

-Rob
# Posted By Rob Gonda on 12/10/05 at 7:24 PM
Rob Brooks-Bilson's Gravatar Dave,

Did you send your mod over to Ray? He's pretty good about folding cool mods into the core in future releases.
# Posted By Rob Brooks-Bilson on 12/10/05 at 8:07 PM
Rob Brooks-Bilson's Gravatar Note to self - read full post before posting redundant comments. Sorry about that!
# Posted By Rob Brooks-Bilson on 12/10/05 at 8:08 PM
Joe Flowers's Gravatar Thanks for the addon! I'm a regular reader of Cuban's blog - which I find quite entertaining, both for the business and NBA aspects - but I haven't been using iceRocket too much. I love the results it returns, I just wish it would return them more quickly...but I guess it's ok to have to wait if you don't have to sift through as many results to find what you're after.
# Posted By Joe Flowers on 12/13/05 at 12:51 AM

© Dave Carabetta, 2005-2008. This blog licensed under the Creative Commons License. Some rights reserved. This is a personal weblog. The opinions expressed here represent my own and not those of my employer. Blog software provided by Raymond Camden.