www.nettime.org
Nettime mailing list archives

Re: <nettime> fwdfyi: Joshua Schachter on URL Shorteners
Rop Gonggrijp on Tue, 14 Apr 2009 13:44:17 +0200 (CEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: <nettime> fwdfyi: Joshua Schachter on URL Shorteners


> As TinyURL fan myself, I couldn't resist this one!
> And it's all the fault of Rop Gonggrijp! (whi introduced me to  
> TinYurl)

I use URL shorteners for the e-mail news letter of  
wijvertrouwenstemcomputersniet.nl. Noit just because we have a long  
domain name, but also many of the documents we link to on the web ar  
eat impossible URLs that just break up the flow of an e-mail  
newsletter way too much. But I am well aware of the drawbacks, so the  
web-version of the same newsletter doesn't use them.

Seeya,

Rop

P.S.: While we're on the topic of TinyURL, I wrote these two PHP- 
functions, in case anyone needs 'em...

function TinyURL($input) {
	global $warnings;
	if (preg_match("/<blockquote><b>(http:\/\/tinyurl.com\/.*?)<\/b><br>/ 
is", file_get_contents("http://tinyurl.com/create.php?url="; .  
urlencode($input)), $matches)) {
		return ($matches[1]);
	} else {
		return false;
	}
}

// Warning: backtick! $input must not come from user, or be sanitized  
to represent a valid URL first.
function unTinyURL($input) {
	if (preg_match("/^Location:\s*(.*?)$/im", `curl --head $input 2>/dev/ 
null`, $matches)) {
		return ($matches[1]);
	} else {
		return false;
	}
}


#  distributed via <nettime>: no commercial use without permission
#  <nettime>  is a moderated mailing list for net criticism,
#  collaborative text filtering and cultural politics of the nets
#  more info: http://mail.kein.org/mailman/listinfo/nettime-l
#  archive: http://www.nettime.org contact: nettime {AT} kein.org