Steffest Digitale Pulptuur

twitter2plurk

Damn, I can't believe I haven't tought of this approach myself, but Ryan Lim did some digging and pulled an unofficial Plurk API out of his sleeve :-)
I's written in PHP.
Here's the original copyright notice.

I translated the bits needed to post a plurk from a 3th party application to vbscript, for use in feedtweeter.
So a few days after plurk2twitter, twitter2plurk is a fact. (And it works!)
Tomorrow I'll update feedtweeter to be able to post to Plurk.


<%

	plurkAccount = "Steffest"
	plurkPass = "*********"
	
	plurk("hello plurkworld!")
	
	
	function plurk(message)
	
		' big thanks to Ryan Lim for doing the digging
		' translated from http://code.google.com/p/rlplurkapi/
		' this is just a small function to send a plurk
		' for a more complete API: http://code.google.com/p/rlplurkapi/
		
		url_login = "http://www.plurk.com/Users/login?redirect_page=main'"
		url_post = "http://www.plurk.com/TimeLine/addPlurk"
	
		' first: login
		poststring = "nick_name=" & plurkAccount & "&password=" & plurkPass
		set objXMLHTTP = Server.CreateObject("MSXML2.SERVERXMLHTTP")
		objXMLHTTP.Open "POST", url_login, false,plurkAccount,plurkPass
		objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
		objXMLHTTP.Send poststring
	
		' then send the plurk
		lang = "en"
    	qualifier = ":"
    	nocomments = "0"
	
		' get the ISO8601date
		postdate = ISO8601date(now(),"+02")
		
		message=server.URLEncode(message)
	
		poststring  = "posted="&postdate&"&qualifier=" & qualifier& "&content="&message&"&lang="&lang&"&no_comments=" & nocomments & "&limited_to="
	
		objXMLHTTP.Open "POST", url_post, false,plurkAccount,plurkPass
		objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
		objXMLHTTP.Send poststring
		plurk = objXMLHTTP.responseText
		set objXMLHTTP=nothing
	
	end function
	
	function ISO8601date(dt,timezone)
		ISO8601date = year(dt) & "-" &  padding(month(dt)) & "-" &  padding(day(dt)) & "T" & hour(dt) & ":" & minute(dt) & ":" &  second(dt) & timezone & ":00"
	end function
	
	function padding(s)
		if len(s)=1 then
			padding="0" & s
		else
			padding = s	
		end if
	end function

Tags: in English, Programming, Scripting, Web 2.0Geef je reactie (2)