Posted By

Sn0opy on 01/05/09


Tagged

url function isgd shortener


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

Sn0opy
will_00
umang_nine


Is.gd Url shortener function


 / Published in: PHP
 

URL: http://is.gd

Well, not the best one...

  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. }

Report this snippet  

You need to login to post a comment.