Change BlogCFC tweetbacks function

Yesterday night, I was troubleshooting why my tweetbacks aren't coming out even they're in Twitter. I've asked Ray about this problem and he told me that previous version of BlogCFC is completely working for tweetbacks but in current version, it doesn't work at all. That's why I was troubleshooting on SweetTweets.cfc and make complicated testing. Finally, I found it's because getShortURLs function of it. In blogCFC infrastructure, it posts blog URL into getShortURLs function and which will make the short URLs and search those short URLs in twitter by getTweetSearchUrl function. So, getTweetSearchUrl found no records for my short URLs in twitter. That's why I've changed not to make short URLs and search Original URLs in twitter and found some of results from twitter as jSON format data.

[More]

Coldfusion Webservices and JSON

I've recently tested CF web services and JSON. The outcome is incredible. Because, I'm very new to JSON and CF web services. That's why I'm very proud of myself what I did. That's what I want to do in Myanmar about synchronization two web applications over the internet for sharing data. In these testing, I've also used Coldfusion ajax submitForm. In briefly, when user type, then will be displayed JSON format. I've got some JSON knowledge from Ben Nadel blog. getJSON.cfc

view plain print about
1<cfcomponent output="false">
2<cffunction name="jsonData" access="remote" returntype="array" returnformat="json" output="false" hint="Return JSON Format Data">
3<cfargument name="Text" type="string" required="true">
4<cfset getJ = ArrayNew(1)>
5<cfloop from="1" to="#ListLen(Text, " ")#" index="i">
6<cfset getJ[i] = ListGetAt(Text, i, " ")>
7</cfloop>
8<cfreturn getJ>
9</cffunction>
10</cfcomponent>
get.cfm
view plain print about
1<html>
2<head>
3<cfajaximport>
4<invalidTag>
5function submitForm() {
6ColdFusion.Ajax.submitForm('myform', 1, 'formAction.cfm', 1, callback,
7errorHandler);
8}
9function callback(text)
10{
11document.getElementById("divShowMsg").innerHTML = text;
12}
13function errorHandler(code, msg)
14{
15alert("Error!!! " + code + ": " + msg);
16}
17</script>
18</head>
19<body>
20<div id="divShowMsg"></div>
21<cfform name="myform">
22<cfinput name="mytext1" size="50">
23<input type="Button" onclick="submitForm()" value="WebServices JSON ">
24</cfform>
25</body>
26</html>
formAction.cfm
view plain print about
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<title>Untitled</title>
5</head>
6<body>
7<cfinvoke webservice="http://localhost/webservices/getJSON.cfc?wsdl" method="jsonData" returnvariable="strg">
8<cfinvokeargument name="Text" value="#form.mytext1#" />
9</cfinvoke>
10<cfdump var="#strg#">
11</body>
12</html>

JSON (JavaScript Object Notation)

JSON, called Javascript Object Notation is being used for integrating computer systems based on XML and WDDX. If using JSON with CFM, you don't need to do much because CFC can output json data.

view plain print about
1<!--- Send an http request to the Yahoo Web Search Service. --->
2<cfhttp url='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=YahooDemo&amp;query="ColdFusion Ajax"&amp;output=json'>
3<!--- The result is a JSON-formatted string that represents a structure.
4Convert it to a ColdFusion structure. --->

5<cfset myJSON=DeserializeJSON(#cfhttp.FileContent#)>
6<!--- Display the results. --->
7<cfoutput>
8
9Results of search for "ColdFusion 8"
10
11There were #myJSON.ResultSet.totalResultsAvailable# Entries.
12
13Here are the first #myJSON.ResultSet.totalResultsReturned#.
14
15<cfloop index="i" from="1" to="#myJSON.ResultSet.totalResultsReturned#">
16    <a href="#myJSON.ResultSet.Result[i].URL#">
17        #myJSON.ResultSet.Result[i].Title#
18    </a>
19    #myJSON.ResultSet.Result[i].Summary#
20</cfloop>
21</cfoutput>

Read more here

Top of Page