Is.gd Url shortener function


/ Published in: PHP

Well, not the best one...


Copy this code and paste it in your HTML
  1. function isgd($link = "") {
  2. $fp = fsockopen("www.is.gd", 80, $errno, $errstr, 30);
  3. if(!$fp) {
  4. return "";
  5. } else {
  6. $out = "GET /api.php?longurl=$link HTTP/1.1
  7. ";
  8. $out .= "Host: www.is.gd
  9. ";
  10. $out .= "Connection: Close
  11.  
  12. ";
  13. fwrite($fp, $out);
  14.  
  15. while(!feof($fp)) {
  16. return substr(strstr(fread($fp, 300), 'http://'), 0, -5);
  17. }
  18. fclose($fp);
  19. }
  20. }

URL: http://is.gd

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.