<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Application Developer &#187; PHP</title>
	<atom:link href="http://applicationdeveloper.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://applicationdeveloper.net</link>
	<description>Making money online</description>
	<lastBuildDate>Sat, 26 Sep 2009 20:31:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Calling #PHP on #JSP / #Java Pages with Javascript &#8211; #js</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/18/calling-php-jsp-java-pages-javascript-js/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 16:34:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[JAVA/JSP]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tweaks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=74</guid>
		<description><![CDATA[Working with hacked together management systems that utilize both Java/JSP and PHP can be extremely annoying. However, jQuery has made our lives a lot easier by letting us call PHP using Javascript.Most of us are script kiddies. Admit it, we like to build our own tools but whenever a shortcut comes into play, we take [...]]]></description>
			<content:encoded><![CDATA[Working with hacked together management systems that utilize both Java/JSP and PHP can be extremely annoying. However, jQuery has made our lives a lot easier by letting us call PHP using Javascript.<br /><br /><img class="alignnone size-full wp-image-76" style="float:right;" title="java" src="http://applicationdeveloper.net/wp-content/uploads/2009/07/java.jpg" alt="java" width="90" height="119" />Most of us are script kiddies. Admit it, we like to build our own tools but whenever a shortcut comes into play, we take the high road. Can you really blame developers for choosing this route when time seems to always be a factor on the Internet. The issue is this leaves us with VERY hacky systems. We piece together and integrate but there are just things we can&#8217;t control. Particularly if we ever end up with anything that&#8217;s not open source.<br /><br />Here&#8217;s a trick for pulling PHP into a JSP run page, or really any page for that matter, as long as it supposed Javascript. Generally speaking, all things support Javascript.<br /><br /><pre class="devcodeblock" title="Javascript"><table class="devcodetools"><tbody><tr><td>&nbsp;Javascript&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard2" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt; </pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline">  $.get(&quot;/location/to/file.php&quot;, function(data) {</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">6</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">   $(&quot;#posthere&quot;).html(data);</pre></td></tr><tr><td class="devcodelines" width="1%">7</td><td class="devcodelinesarea"><pre class="devcode devcodeline">  });</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">8</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// ]]&gt;&lt;/script&gt;</pre></td></tr><tr><td class="devcodelines" width="1%">9</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br /><br /><a href="http://jquery.com/" target="_blank"><img class="alignnone size-full wp-image-75" style="float:right;" title="jQuery" src="http://applicationdeveloper.net/wp-content/uploads/2009/07/jQuery.jpg" alt="jQuery" width="232" height="67" /></a>Here's how this works. jQuery we should all know. If you don't, go do some reading. It's a big deal.<br /><br />$.get is from jQuery and it will pull the information over and display it.<br /><br />#posthere is key. The<div id="posthere">is where what you want to load will show up. <br /><br />Pretty much from this point you're set. All you need to do is build the PHP file and everything will load up on the JSP pages. Remember, this can applied to any page that supports jQuery or Javascript.</div>]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/18/calling-php-jsp-java-pages-javascript-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>User Authentication Through Twitter OAuth or cURL</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/17/user-authentication-twitter-oauth-curl/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 12:43:51 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[user management]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=68</guid>
		<description><![CDATA[Twitter offers 2 types of authentication. Using the standard cURL GET HTTP protocols or the new and fancy OAuth. cURL is easy, we all get it, and it works great. However, OAuth offers a wide range of fancy features, most importantly, securtiy.Taken from the OAuth website &#8211; An open protocol to allow secure API authorization [...]]]></description>
			<content:encoded><![CDATA[<a href="http://twitter.com/" target="_blank">Twitter</a> offers 2 types of authentication. Using the standard cURL GET HTTP protocols or the new and fancy OAuth. cURL is easy, we all get it, and it works great. However, OAuth offers a wide range of fancy features, most importantly, securtiy.<br /><br />Taken from the <a href="http://oauth.net/" target="_blank">OAuth</a> website &#8211; <em>An <a href="http://oauth.net" target="_blank"><img class="aligncenter size-full wp-image-69" style="float:right;" title="oauth" src="http://applicationdeveloper.net/wp-content/uploads/2009/07/oauth.jpg" alt="oauth" width="215" height="66" /></a>open protocol to allow secure API authorization  in a simple and standard method from desktop and web applications.</em> It&#8217;s a terrific idea and I&#8217;m glad someone is coming out with it. To make things easier there are also developers who&#8217;ve already done the work for you. Here&#8217;s a <a href="http://github.com/abraham/twitteroauth/tree/master" target="_blank">pre-built script</a> that does all the OAuth for you. There&#8217;s also a <a href="http://www.hueniverse.com/hueniverse/2007/10/beginners-guide.html" target="_blank">Beginners Guide</a>.<br /><br />When the benefits are increased security, a higher level of compatibility, and new fancy technology, why bother with cURL anymore?<br /><br />It&#8217;s pretty simple. cURL is easier, and it doesn&#8217;t require anything beyond what we know. Setting everything up with OAuth takes a few hours to wrap your head around. Compared to figuring out OAuth, here&#8217;s how to connect with cURL.<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard5" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">01</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">02</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$loginUsername = &quot;username&quot;;   </pre></td></tr><tr><td class="devcodelines" width="1%">03</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$loginPassword = &quot;password&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">04</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">05</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$url = &quot;https://twitter.com/statuses/followers/&quot; . $username . &quot;.xml&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">06</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">07</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$curl_handle = curl_init();</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">08</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_URL, $url);</pre></td></tr><tr><td class="devcodelines" width="1%">09</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_HTTPGET, 1); //GET method</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">10</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //basic authentication</pre></td></tr><tr><td class="devcodelines" width="1%">11</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_USERPWD, $loginUsername . &quot;:&quot; . $loginPassword); //login</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">12</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);</pre></td></tr><tr><td class="devcodelines" width="1%">13</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); //Return the string</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">14</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$buffer = curl_exec($curl_handle);</pre></td></tr><tr><td class="devcodelines" width="1%">15</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_close($curl_handle);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">16</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />There you have it, you're logged in, or at the very least authenticated. Here's how to report back:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard6" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=6&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// check for success or failure</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">if (empty($buffer) || strpos($buffer, &quot;Could not authenticate you&quot;)) {</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $replyStatus = &quot;Failed: Please check your username and password&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline">} else {</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">6</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $replyStatus = &quot;Success: You are logged in.&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">7</td><td class="devcodelinesarea"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">8</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br /><a href="http://twitter.com/appdevnet" target="_blank"><img style="float:right;" class="alignnone size-full wp-image-70" title="twit-fol" src="http://applicationdeveloper.net/wp-content/uploads/2009/07/twit-fol.jpg" alt="twit-fol" width="200" height="121" /></a>Twitter currently supports both without offering many benefits to either choice. cURL isn't really anything new but it's simple while OAuth will continue to develop. For serious developers who plan for longevity with their Twitter Application sites, I highly recommend taking the extra effort to at least understand OAuth enough to switch to it when they demand it. In the meantime, forget it and stick with cURL until the benefits outweigh the cons.]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/17/user-authentication-twitter-oauth-curl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BackType Tweetcount 1.2 with su.pr Short URL Support</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/14/backtype-tweetcount-12-supr-short-url-support/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 12:34:08 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tweaks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[backtype]]></category>
		<category><![CDATA[social marketing]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=52</guid>
		<description><![CDATA[The new BackType Tweetcount just launched last night. With a little work, it&#8217;ll support your very own custom shortened URL in the re-tweet. We like su.pr. Thanks to a bit of help from Michael of BackType, we&#8217;re able to figure out this mod overnight.The previous version of BackType worked well but it always re-tweet your [...]]]></description>
			<content:encoded><![CDATA[The new <a href="http://wordpress.org/extend/plugins/backtype-tweetcount/" target="_blank">BackType Tweetcount</a> just launched last night. With a little work, it&#8217;ll support your very own custom shortened URL in the re-tweet. We like <a href="http://su.pr" target="_blank">su.pr</a>. Thanks to a bit of help from <a href="http://twitter.com/michaelmontano">Michael of BackType</a>, we&#8217;re able to figure out this mod overnight.<br /><br />The previous version of BackType worked well but it always re-tweet your posts through <a href="http://awe.sm" target="_blank">awe.sm</a>. That&#8217;s great and all, but what about the rest of us who have our own click tracking or even our own custom shorteners.<a href="http://backtype.com"><img src="http://applicationdeveloper.net/wp-content/uploads/2009/07/backtype.jpg" alt="backtype" title="backtype" width="122" height="39" class="alignnone size-full wp-image-53" style="float:right;" /></a><br /><br />So to make it better, last night we added a new option for developers to add a function into the code that will allow them to build their own custom functions and generate their own custom links. It&#8217;s really just a meta tag, &#8220;<em>bttc_short_url</em>&#8221; that gets generated the first time the post is viewed. Here&#8217;s the best part. Since the short url is generated the FIRST time everything is viewed. Just by browsing your pages, and olf non-syndicated links are automatically added into su.pr. If you use another shortening service, it&#8217;ll do the same for that too.<br /><br />After grabbing the latest BackType Tweetcount, load up your favorite editing tool and add this function to the very bottom of the code:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard11" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=11&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">01</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">02</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">function bttc_supr($url) {</pre></td></tr><tr><td class="devcodelines" width="1%">03</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	$SU_username = &quot;username&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">04</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	$SU_api = &quot;api_key&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">05</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	$SU_url = &quot;http://su.pr/api&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">06</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	$SU_vars = &quot;?url=$url&amp;login=$SU_username&amp;apiKey=$SU_api&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">07</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">08</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	$curl_handle = curl_init();</pre></td></tr><tr><td class="devcodelines" width="1%">09</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	curl_setopt($curl_handle, CURLOPT_URL, $SU_url . $SU_vars);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">10</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);</pre></td></tr><tr><td class="devcodelines" width="1%">11</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">12</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	curl_setopt($curl_handle, CURLOPT_HTTPGET, 1); </pre></td></tr><tr><td class="devcodelines" width="1%">13</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	$buffer = curl_exec($curl_handle);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">14</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	curl_close($curl_handle);</pre></td></tr><tr><td class="devcodelines" width="1%">15</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	//$SU_newURL = str_replace(&quot;su.pr/&quot;, &quot;&quot;, $buffer);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">16</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	$SU_newURL = $buffer;</pre></td></tr><tr><td class="devcodelines" width="1%">17</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">18</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	return $SU_newURL;</pre></td></tr><tr><td class="devcodelines" width="1%">19</td><td class="devcodelinesarea"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">20</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />As a quick note there. The commented out <em>//$SU_newurl</em> is for those that host their own url shortcodes on their domain using the su.pr htaccess modification.<br /><br />Go to Line 180, insert this code:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard12" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=12&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">if (get_post_meta($post-&gt;ID, 'bttc_short_url', true) != '') {</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">    $button .= 'tweetcount_short_url=\'' . wp_specialchars(get_post_meta($post-&gt;ID, 'bttc_short_url', true), '1') . '\';';</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />Then go to Line 161, search for this code:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard13" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=13&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">if ($meta == '') {</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	add_post_meta($post-&gt;ID, 'bttc_cache', time() . ':' . $cnt);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">} else {</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	update_post_meta($post-&gt;ID, 'bttc_cache', time() . ':' . $cnt);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">6</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines" width="1%">7</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />Directly below the code, paste the following:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard14" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=14&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">if (get_post_meta($post-&gt;ID, 'bttc_short_url', true) == '') {</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline">	$short_url = bttc_supr($url);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">4</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	if ($short_url) {</pre></td></tr><tr><td class="devcodelines" width="1%">5</td><td class="devcodelinesarea"><pre class="devcode devcodeline">		add_post_meta($post-&gt;ID, 'bttc_short_url', $short_url);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">6</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">	}</pre></td></tr><tr><td class="devcodelines" width="1%">7</td><td class="devcodelinesarea"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">8</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />And that's it. Edit the first bttc_supr function into basically whatever you want, and the short URL will automatically generated the first time the posts are viewed. It'll let you re-tweet with your own custom links, and even add old content that you haven't added to your shortening admin pages for you. This is a pretty raw version of doing this. BackType will be launching an updated version soon with these modifications to make it easier for users that don't want to edit as much code.]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/14/backtype-tweetcount-12-supr-short-url-support/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Post to Twitter using cURL</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/12/post-twitter-curl/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 13:20:36 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=27</guid>
		<description><![CDATA[Having a choice of 50 Wordpress plugins are great when you are using Wordpress but what do you do when you have custom made software or don&#8217;t use Wordpress?Using this handy cURL php code, you can post to Twitter from anywhere on your website. You can include the code as is, or just stick it [...]]]></description>
			<content:encoded><![CDATA[Having a choice of 50 Wordpress plugins are great when you are using Wordpress but what do you do when you have custom made software or don&#8217;t use Wordpress?<br /><br />Using this handy cURL php code, you can post to Twitter from anywhere on your website. You can include the code as is, or just stick it into a function that you can include across all your scripts that need it.<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard16" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=16&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">01</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">02</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// Set username and password</pre></td></tr><tr><td class="devcodelines" width="1%">03</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$username = '$username';</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">04</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$password = '$password';</pre></td></tr><tr><td class="devcodelines" width="1%">05</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// The message you want to send</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">06</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$message = $TWITTER_POST;</pre></td></tr><tr><td class="devcodelines" width="1%">07</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// The twitter API address</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">08</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$url = 'http://twitter.com/statuses/update.xml';</pre></td></tr><tr><td class="devcodelines" width="1%">09</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// Alternative JSON version</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">10</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// $url = 'http://twitter.com/statuses/update.json';</pre></td></tr><tr><td class="devcodelines" width="1%">11</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// Set up and execute the curl process</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">12</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$curl_handle = curl_init();</pre></td></tr><tr><td class="devcodelines" width="1%">13</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_URL, &quot;$url&quot;);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">14</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);</pre></td></tr><tr><td class="devcodelines" width="1%">15</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">16</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_POST, 1);</pre></td></tr><tr><td class="devcodelines" width="1%">17</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_POSTFIELDS, &quot;status=$message&quot;);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">18</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_USERPWD, &quot;$username:$password&quot;);</pre></td></tr><tr><td class="devcodelines" width="1%">19</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$buffer = curl_exec($curl_handle);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">20</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_close($curl_handle);</pre></td></tr><tr><td class="devcodelines" width="1%">21</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// check for success or failure</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">22</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">if (empty($buffer)) {</pre></td></tr><tr><td class="devcodelines" width="1%">23</td><td class="devcodelinesarea"><pre class="devcode devcodeline">//    echo 'message';</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">24</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">} else {</pre></td></tr><tr><td class="devcodelines" width="1%">25</td><td class="devcodelinesarea"><pre class="devcode devcodeline">//    echo 'success';</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">26</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines" width="1%">27</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />I commented out the messages but I left them in for debugging purposes. Just uncomment then and start testing. Here's the end result... as if we didn't know what it would look like anyway.<p style="text-align: center;"><img class="size-full wp-image-29 aligncenter" title="cURL Twitter Post" src="http://applicationdeveloper.net/wp-content/uploads/2009/07/curl-twitter-post.jpg" alt="cURL Twitter Post" width="427" height="220" /></p>
<br />This is really just a snippet, you can expand on this and even create forms that request the username and password for distributable scripts or replies from your traffic.]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/12/post-twitter-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>su.pr &#8211; cURL Links into your Account with Login/API</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/11/supr-curl-links-account-loginapi/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 12:52:22 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[su.pr]]></category>
		<category><![CDATA[syndication]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=11</guid>
		<description><![CDATA[Unlike bit.ly, tinyurl, or any of the other 50 services, su.pr is the first URL shortener to also syndicate content. I&#8217;m a bit late in posting about this but they did a terrific job on their URL shortener. The catch here is that it also syndicates in StumbleUpon (SU) which is absolutely kick ass. You [...]]]></description>
			<content:encoded><![CDATA[Unlike <a href="http://bit.ly">bit.ly</a>, <a href="http://tinyurl.com">tinyurl</a>, or any of the other 50 services, <a href="http://su.pr">su.pr</a> is the first <a href="http://en.wikipedia.org/wiki/URL_shortening">URL shortener</a> to also syndicate content. I&#8217;m a bit late in posting about this but they did a terrific job on their URL shortener. The catch here is that it also syndicates in <a href="http://stumbleupon.com">StumbleUpon </a>(SU) which is absolutely kick ass. You know what that means? More traffic, a content-rich SU blog, and more links into the Internet.<br /><br />This handy snippet of code will take the $url variable and churn it through the system to generate your new $SU_newURL.<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard19" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=19&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">01</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">02</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// Set username and password</pre></td></tr><tr><td class="devcodelines" width="1%">03</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$SU_username = &quot;username&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">04</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$SU_api = &quot;34827348732fakekey&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">05</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">06</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// The SUPR API address</pre></td></tr><tr><td class="devcodelines" width="1%">07</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$SU_url = &quot;http://su.pr/api&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">08</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">09</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// URL to Shorten</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">10</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$SU_shortUrl=&quot;$url&quot;;</pre></td></tr><tr><td class="devcodelines" width="1%">11</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">12</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// Combine URL</pre></td></tr><tr><td class="devcodelines" width="1%">13</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$SU_vars = &quot;?url=$SU_shortUrl&amp;login=$SU_username&amp;apiKey=$SU_api&quot;;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">14</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">15</td><td class="devcodelinesarea"><pre class="devcode devcodeline">// Set up and execute the curl process</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">16</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$curl_handle = curl_init();</pre></td></tr><tr><td class="devcodelines" width="1%">17</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_URL, $SU_url . $SU_vars);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">18</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);</pre></td></tr><tr><td class="devcodelines" width="1%">19</td><td class="devcodelinesarea"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">20</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_setopt($curl_handle, CURLOPT_HTTPGET, 1); </pre></td></tr><tr><td class="devcodelines" width="1%">21</td><td class="devcodelinesarea"><pre class="devcode devcodeline">$buffer = curl_exec($curl_handle);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">22</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">curl_close($curl_handle);</pre></td></tr><tr><td class="devcodelines" width="1%">23</td><td class="devcodelinesarea"><pre class="devcode devcodeline">/*</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">24</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">// check for success or failure</pre></td></tr><tr><td class="devcodelines" width="1%">25</td><td class="devcodelinesarea"><pre class="devcode devcodeline">if (empty($buffer)) {</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">26</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">    echo 'message';</pre></td></tr><tr><td class="devcodelines" width="1%">27</td><td class="devcodelinesarea"><pre class="devcode devcodeline">} else {</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">28</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">    echo $buffer;</pre></td></tr><tr><td class="devcodelines" width="1%">29</td><td class="devcodelinesarea"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">30</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">*/</pre></td></tr><tr><td class="devcodelines" width="1%">31</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">32</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">//$SU_newURL = str_replace(&quot;su.pr/&quot;, &quot;&quot;, $buffer);</pre></td></tr><tr><td class="devcodelines" width="1%">33</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">34</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">echo $SU_newURL;</pre></td></tr><tr><td class="devcodelines" width="1%">35</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />This part here is optional:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard20" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=20&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">1</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">2</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">$SU_newURL = str_replace(&quot;su.pr/&quot;, &quot;&quot;, $buffer);</pre></td></tr><tr><td class="devcodelines" width="1%">3</td><td class="devcodelinesarea"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>
<br />When you use the "sync" or host the shortened URL on your own domain through the su.pr .htaccess mods, it returns the hash and link as http://su.pr/domain.com/hash_key<br /><br />That can kind of mess things up. All the optional code does is extra the su.pr out.]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/11/supr-curl-links-account-loginapi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>String Handling: Parsing Links from a String</title>
		<link></link>
		<comments>http://applicationdeveloper.net/2009/07/10/string-handling-parsing-links-string/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 14:33:17 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string handling]]></category>

		<guid isPermaLink="false">http://applicationdeveloper.net/?p=6</guid>
		<description><![CDATA[With the popularity of APIs that connect to Twitter, Facebook, and even sites like StumbleUpon, it&#8217;s becoming increasing important to work with String Handling functions.Here&#8217;s a very handy function to replace a link in a String with the html format for posting on the web.I can&#8217;t remember where I got this from but someone deserves [...]]]></description>
			<content:encoded><![CDATA[With the popularity of APIs that connect to <a href="http://twitter.com">Twitter</a>, <a href="http://facebook.com">Facebook</a>, and even sites like <a href="http://stumbleupon.com">StumbleUpon</a>, it&#8217;s becoming increasing important to work with String Handling functions.<br /><br />Here&#8217;s a very handy function to replace a link in a String with the html format for posting on the web.<br /><br />I can&#8217;t remember where I got this from but someone deserves credit for helping write this:<br /><br /><pre class="devcodeblock" title="PHP"><table class="devcodetools"><tbody><tr><td>&nbsp;PHP&nbsp;|&nbsp;</td><td style="background-image:url('http://applicationdeveloper.net/wp-content/plugins/devformatter/img/devformatter-copy.png');background-repeat:no-repeat;background-position:50% 50%;width:16px;height:16px;"/><embed id="ZeroClipboard22" src="http://applicationdeveloper.net/wp-content/plugins/devformatter/_zclipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="16px" height="16px" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=22&width=16&height=16" wmode="transparent" /></td><td>&nbsp;copy&nbsp;code&nbsp;|</td><td style="cursor:pointer" title="DevFormatter Plugin" onclick="devfmt_credits()">?</td><td width="99%">&nbsp;</td></tr></tbody></table><div class="devcodeoverflow"><table class="devcodearea" width="100%"><tr><td class="devcodelines" width="1%">01</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> </pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">02</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">function clickable_link($text)</pre></td></tr><tr><td class="devcodelines" width="1%">03</td><td class="devcodelinesarea"><pre class="devcode devcodeline">{</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">04</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $text = preg_replace('#(script|about|applet|activex|chrome):#is', &quot;:&quot;, $text);</pre></td></tr><tr><td class="devcodelines" width="1%">05</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">06</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // pad it with a space so we can match things at the start of the 1st line.</pre></td></tr><tr><td class="devcodelines" width="1%">07</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> $ret = ' ' . $text;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">08</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines" width="1%">09</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> // matches an &quot;xxxx://yyyy&quot; URL at the start of a line, or after a space.</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">10</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // xxxx can only be alpha characters.</pre></td></tr><tr><td class="devcodelines" width="1%">11</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> // yyyy is anything up to the first space, newline, comma, double quote or &lt;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">12</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $ret = preg_replace(&quot;#(^|[\n ])([\w]+?://[\w\#$%&amp;~/.\-;:=,?@\[\]+]*)#is&quot;, &quot;&lt;a href=&quot;\&quot; target=&quot;\&quot;_blank\&quot;&quot;&gt;&lt;/a&gt;&quot;, $ret);</pre></td></tr><tr><td class="devcodelines" width="1%">13</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">14</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // matches a &quot;www|ftp.xxxx.yyyy[/zzzz]&quot; kinda lazy URL thing</pre></td></tr><tr><td class="devcodelines" width="1%">15</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> // Must contain at least 2 dots. xxxx contains either alphanum, or &quot;-&quot;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">16</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // zzzz is optional.. will contain everything up to the first space, newline,</pre></td></tr><tr><td class="devcodelines" width="1%">17</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> // comma, double quote or &lt;.</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">18</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $ret = preg_replace(&quot;#(^|[\n ])((www|ftp)\.[\w\#$%&amp;~/.\-;:=,?@\[\]+]*)#is&quot;, &quot;&lt;a href=&quot;\&quot; target=&quot;\&quot;_blank\&quot;&quot;&gt;&lt;/a&gt;&quot;, $ret);</pre></td></tr><tr><td class="devcodelines" width="1%">19</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">20</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // matches an email@domain type address at the start of a line, or after a space.</pre></td></tr><tr><td class="devcodelines" width="1%">21</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> // Note: Only the followed chars are valid; alphanums, &quot;-&quot;, &quot;_&quot; and or &quot;.&quot;.</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">22</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> $ret = preg_replace(&quot;#(^|[\n ])([a-z0-9&amp;\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i&quot;, &quot;&lt;a href=&quot;\&quot;&gt;@&lt;/a&gt;&quot;, $ret);</pre></td></tr><tr><td class="devcodelines" width="1%">23</td><td class="devcodelinesarea"><pre class="devcode devcodeline">&nbsp;</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">24</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> // Remove our padding..</pre></td></tr><tr><td class="devcodelines" width="1%">25</td><td class="devcodelinesarea"><pre class="devcode devcodeline"> $ret = substr($ret, 1);</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">26</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"> return $ret;</pre></td></tr><tr><td class="devcodelines" width="1%">27</td><td class="devcodelinesarea"><pre class="devcode devcodeline">}</pre></td></tr><tr><td class="devcodelines devcodelinesodd" width="1%">28</td><td class="devcodelinesarea devcodelinesareaodd"><pre class="devcode devcodeline"></pre></td></tr></table></div></pre>]]></content:encoded>
			<wfw:commentRss>http://applicationdeveloper.net/2009/07/10/string-handling-parsing-links-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->