post to twitter using cli.gs and php

2 views
Skip to first unread message

Thor Erik

unread,
Oct 1, 2008, 12:08:23 PM10/1/08
to Cli.gs Interested
This is a WIP script i've been working on, it uses cli.gs instead of
the traditional tinyurl way.
As of yet it dose not post it to your own cli.gs account, but that
will hopefully be done when there is an API to work with :)

the file:
http://cligs-interested.googlegroups.com/web/cligs.php
you just simply make a bookmark like this:
javascript:(function(){%20window.open('http://example.com/cligs.php?
url='+encodeURIComponent(location.href)
+'&title='+encodeURIComponent(document.title));%20})();

the script takes care of the rest.
note that it requires CURL to handle it, but can quickly be ported to
use fopen or any other library that you may think of.


ps.
It's quick and dirty. don't expect some fancy regex to handle the url
finding :p

Pierre Far

unread,
Oct 2, 2008, 8:21:22 AM10/2/08
to Cli.gs Interested
Thanks for that Thor.

I like it because it's quick and simple and shows how to do it using
the bookmarklet mechanism. The API will allow you to do something
similar too.

Of course as with all demos posted here and elsewhere on the web,
*PLEASE* add data sanitization to the scripts before you deploy them
in the real world. It's not good being open to a security hole. Just a
friendly reminder :)

Thanks again!

Pierre

Thor Erik

unread,
Oct 2, 2008, 12:25:10 PM10/2/08
to Cli.gs Interested
I'm well aware of the security issues.
as i said, quick and dirty(and in dirty you would expect things like
data sanitation to not be there :p at least i do)
when you Open up the API i will probably add that to it too, as my
older post-to-twitter script using tinyurl was way too different(for
one thing designed to work on my local network, not be hosted on a
webpage like this one is made to do)

one quick thing to do is to remove the two encodeURIComponent()
functions into php and pass the variables in clear.
Reply all
Reply to author
Forward
0 new messages