Have You Seen Hookr.io Lately?

Early last year a new online resource was launched for WordPress developers called Hookr.io. The website is described as The WordPress Hook/API Index, but it is so much more.

hookr-wordpress-resourceFast forward to today and Hookr.io has just launched a new beta layout. Not only does the website feature documentation for WordPress Core, but it also includes information on popular plugins and themes.  Hookr.io displays more than just action and filter hooks, it also includes all Classes, Constants, Functions, and Shortcodes available.  You can easily filter through the data to find exactly what you are looking for.  The new beta also features a more simplified UI and is device agnostic.

Hookr.io is a very valuable resource for all WordPress developers.   If you haven’t already, bookmark this website.  You will thank me later!

How to: Update FriendFeed using ASP

By StrangeWork.com: Last week the popular feed aggregator FriendFeed launched their new API.

FriendFeed Logo The new API makes it easy for anyone to create custom applications to interact with FriendFeed.

Below is a script I wrote in ASP to post an image and link to your feed stream using XMLHTTP. I’ve included the complete script for download at the bottom of this post.

‘*** set your FriendFeed username and remote key variables
‘*** your users can obtain their remote key here: http://friendfeed.com/remotekey
ff_username = “username”
ff_remotekey = “remotekey”

‘*** set the URL you want to link to
ff_url = “http://snapfoo.com”

‘*** set the text to add to your post
ff_update = “Visit SnapFoo.com”

‘*** set the image URL to post to FriendFeed
‘*** this will be posted as a thumbnail on your feed
ff_filename = “http://snapfoo.com/images/snapfoo_logo.jpg”

‘*** package all of your variables in one variable to post to the FriendFeed API
ff_post = “http://” & URLEncode(ff_username) & “:” & URLEncode(ff_remotekey) & “@friendfeed.com/api/share?title=” & URLEncode(ff_update) & “&link=” & URLEncode(ff_url) & “&image0_url=” & URLEncode(ff_filename)

‘*** post the update
Set xml = Server.CreateObject(“Microsoft.XMLHTTP”)
xml.Open “POST”, ff_post, False
xml.setRequestHeader “Content-Type”, “content=text/html; charset=iso-8859-1”
xml.Send
Set xml = Nothing

That’s it! Using the above method you can easily create scripts to update FriendFeed with text, links, and photos!

Download Source File to Update FriendFeed using ASP

How to: Update Pownce using ASP

By StrangeWork.com: On February 28th, 2008 Pownce released version 2.0 of their API. The major update in this new version is the ability to post messages, links, files, events and even replies via the API directly to a Ponwce.com account.

Pownce LogoBelow is an ASP script I wrote to update your Pownce profile automatically through the new API. I’ve included the complete script for download at the bottom of this post.

Pownce requires the username and password values be encoded using base64. Below is an ASP function that will convert any value over to base64 encode.

const BASE_64_MAP_INIT = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/”
dim nl
‘ zero based arrays
dim Base64EncMap(63)
dim Base64DecMap(127)

‘ must be called before using anything else
PUBLIC SUB initCodecs()
‘ init vars
nl = “

” & chr(13) & chr(10)
‘ setup base 64
dim max, idx
max = len(BASE_64_MAP_INIT)
for idx = 0 to max – 1
‘ one based string
Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1)
next
for idx = 0 to max – 1
Base64DecMap(ASC(Base64EncMap(idx))) = idx
next
END SUB

‘ encode base 64 encoded string
PUBLIC FUNCTION base64Encode(plain)

if len(plain) = 0 then
base64Encode = “”
exit function
end if

dim ret, ndx, by3, first, second, third
by3 = (len(plain) 3) * 3
ndx = 1
do while ndx <= by3 first = asc(mid(plain, ndx+0, 1)) second = asc(mid(plain, ndx+1, 1)) third = asc(mid(plain, ndx+2, 1)) ret = ret & Base64EncMap( (first 4) AND 63 ) ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second 16) AND 15 ) ) ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third 64) AND 3 ) ) ret = ret & Base64EncMap( third AND 63) ndx = ndx + 3 loop ' check for stragglers if by3 < len(plain) then first = asc(mid(plain, ndx+0, 1)) ret = ret & Base64EncMap( (first 4) AND 63 ) if (len(plain) MOD 3 ) = 2 then second = asc(mid(plain, ndx+1, 1)) ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second 16) AND 15 ) ) ret = ret & Base64EncMap( ((second * 4) AND 60) ) else ret = ret & Base64EncMap( (first * 16) AND 48) ret = ret & "=" end if ret = ret & "=" end if base64Encode = ret END FUNCTION ' initialize call initCodecs

Every site/script that interacts with the Pownce API requires an application key. To get your application key, simply register a new application on Pownce. Just replace {app_key} in the below script with the application key that Pownce provides to you.

In this example we will be posting a LINK to your Pownce profile. Be sure to reference the Pownce 2.0 API documentation for specifications on posting messages, events, files, etc.

‘*** set your Pownce username and password variables
p_username = “username”
p_password = “password”

p_username = p_username & “:” & p_password

‘*** Base64 encode your username and password
p_username = base64Encode(p_username)

‘*** replace {app_key} with YOUR application key
strPownce = “http://api.pownce.com/2.0/send/link.xml?app_key={app_key}”

‘*** the link you want to post to Pownce
pownce_link = “http://snapfoo.com/images/snapfoo_logo.jpg”

‘*** the description you want to post to Pownce
pownce_update = “SnapFoo.com Logo – Foo You!”

Set xml = Server.CreateObject(“Microsoft.XMLHTTP”)
xml.Open “POST”, strPownce, False
xml.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
xml.setRequestHeader “Authorization”, “BASIC ” & p_username
xml.Send(“note_to=public&url=” & pownce_link & “&note_body=”&pownce_update)

‘*** view the Pownce response
Response.Write xml.responseText

Set xml = Nothing

That’s it! Using the above method you can easily create scripts to update Pownce with anything you would like.

Download Source File to Update Pownce using ASP

Google OpenSocial Launches Today, Hallelujah!

Google.com LogoBy StrangeWork.com: Google has announced a new project they are launching today called OpenSocial. OpenSocial is a set of three common APIs for building custom applications across multiple social networks. The three core functions and information will consist of:

  • Profile Information (user data)
  • Friends Information (social graph)
  • Activities (things that happen, News Feed type stuff)

At launch the participating social networks include Orkut, Salesforce, LinkedIn, Ning, Hi5, Plaxo, Friendster, Viadeo and Oracle. Obviously missing from this list is Facebook, Myspace, and Bebo. We can only hope that with the success OpenSocial is likely to see these networks will join in.

This is great news for us developers out there having trouble keeping up with the speed at which sites are releasing open APIs to interact with. Another huge benefit of a single site to manage all custom applications is OpenSocial does not have its own markup language. Developers can use normal javascript, html, and embedded flash elements.

Expect a more detailed write-up once I’ve had a chance to create some applications using OpenSocial.

You can access OpenSocial later today at:
http://code.google.com/apis/opensocial

How To: Update your Twitter status with ASP

Here is a simple script I wrote in classic ASP to update your Twitter status via the Twitter API. This script handles basic HTTP authentication to validate your Twitter account and URL Encoding to send over friendly status updates.

<%
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")

twitter_username = "username"	'change to your twitter username
twitter_password = "password"	'change to your twitter password

new_status = "visit strangework.com!"		'change to your new status

xml.Open "POST", "http://" & twitter_username & ":" & twitter_password & "@twitter.com/statuses/update.xml?status=" & server.URLencode(new_status), False
xml.setRequestHeader "Content-Type", "content=text/html; charset=iso-8859-1"
xml.Send

Response.Write xml.responseText		'view Twitter's response

Set xml = Nothing
%>