7
June 2005
Adding a blogger ping utility to BlogCFM
[Coldfusion] [BlogCFM]
Post a Comment
Since MXNA is aggregating my feed now, I needed to have BlogCFM notify MXNA when a new post was done.
Previously , I showed how to add your own configuration options to BlogCFM. This time I added a PING_ON_UPDATE configuration option, along with adding the field to the admin screen.
My SendPings function is very simple but could use some work for error checking and stuff. Perhaps I will work in some error checking later but since it is only me using this function currently, I know I will type in the correct ping URLs.
I added the following to the BlogCFM.cfc but could be used in any blog really. It accepts one argument, a list of URLs to send to seperated by ";"
Next was to tell BlogCFM to send the pings.
I put the following below the notifications area of SaveEntry()
That did it! Now BlogCFM will ping whatever URLs I type into the admin screen (MXNA).
Previously , I showed how to add your own configuration options to BlogCFM. This time I added a PING_ON_UPDATE configuration option, along with adding the field to the admin screen.
My SendPings function is very simple but could use some work for error checking and stuff. Perhaps I will work in some error checking later but since it is only me using this function currently, I know I will type in the correct ping URLs.
I added the following to the BlogCFM.cfc but could be used in any blog really. It accepts one argument, a list of URLs to send to seperated by ";"
<cffunction name="SendPings" access="public" output="false" returntype="void">
<cfargument name="UrlLIST" type="string" required="yes" hint="A list of URLs seperated by ;">
<cfloop from="1" to="#listlen(arguments.UrlList,";")#" index="listindex">
<cfhttp url="#listgetat(arguments.UrlList,listindex,";")#" throwonerror="no"></cfhttp>
</cfloop>
</cffunction>
<cfargument name="UrlLIST" type="string" required="yes" hint="A list of URLs seperated by ;">
<cfloop from="1" to="#listlen(arguments.UrlList,";")#" index="listindex">
<cfhttp url="#listgetat(arguments.UrlList,listindex,";")#" throwonerror="no"></cfhttp>
</cfloop>
</cffunction>
Next was to tell BlogCFM to send the pings.
I put the following below the notifications area of SaveEntry()
<cfif getBlogConfigValue(arguments.blog_id, "PING_ON_UPDATE") NEQ "">
<cfset SendPings(getBlogConfigValue(arguments.blog_id, "PING_ON_UPDATE"))>
</cfif>
<cfset SendPings(getBlogConfigValue(arguments.blog_id, "PING_ON_UPDATE"))>
</cfif>
That did it! Now BlogCFM will ping whatever URLs I type into the admin screen (MXNA).
Posted by fwscott at 9:47 PM | Comments (2)
Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Re: Adding a blogger ping utility to BlogCFM
To get the ping to work, do you just put in a list of pinging places?
do you have to add something to the end of them like ?id=yourwebsite.com or something? thanks
Posted by chris on February 20, 2007 at 2:16 PM
Re: Adding a blogger ping utility to BlogCFM
Hi Chris,
The list of URLs passed into the function could contain a URL with a http://myaggregator.com/ping?yourwebsite.com. The URL you need to ping will be specified by the aggregator. I know with MXNA, a website id is passed as part of the URL.
Also, if your URL needs to contain the ';' character, you will need a different list seperator for the function to work.
Hope this helps, Francis "Scotty" Scott
Posted by fwscott on February 20, 2007 at 9:01 PM