Return to Snippet

Revision: 10585
at January 5, 2009 09:10 by Sn0opy


Initial Code
function isgd($link = "") {
	$fp = fsockopen("www.is.gd", 80, $errno, $errstr, 30);
 	if(!$fp) {
 		return "";
 	} else {
 		$out = "GET /api.php?longurl=$link HTTP/1.1
";
 		$out .= "Host: www.is.gd
";
 		$out .= "Connection: Close

";
 		fwrite($fp, $out);

 		while(!feof($fp)) {
 			return substr(strstr(fread($fp, 300), 'http://'), 0, -5);
 		}
 		fclose($fp);
 	}
}

Initial URL
http://is.gd

Initial Description
Well, not the best one...

Initial Title
Is.gd Url shortener function

Initial Tags
url, function

Initial Language
PHP