/ Published in: PHP

The first function make short urls.
The second function decode a short url with CURL. It gets the http header of the short url page. If the header contains a "Location:" header, then it's a redirect, and the decoded url is the url in the "Location" header string, here is the code:
The second function decode a short url with CURL. It gets the http header of the short url page. If the header contains a "Location:" header, then it's a redirect, and the decoded url is the url in the "Location" header string, here is the code:
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function doShortURL($url) { return $short_url; } function doShortURLDecode($url) { return $a[1]; }
URL: http://www.barattalo.it/2009/12/29/tiny-url-encode-and-decode-with-php/
Comments
