hi,
I have a script that dynamically generates files and links for those files.
I have seen http://tinyurl.com which shortens the url when given a long url into a smaller one.
My problem is i want to generate the short urls dynamically so that everytime i create the urls, i get the short urls dynamically.
is there an api for doing the same??
url shortening api in php??
Moderator: General Moderators
Re: url shortening api in php??
u tried url_rewriting with apache? just rewrite the .htaccess whenever u need to with rewrite rules and shorteneded urls.
Re: url shortening api in php??
The below code ,i found on google search
function shortenurl($url){
if(strlen($url) > 45){
return substr($url, 0, 30)."[...]".substr($url, -15);
}else{
return $url;
}
}
may be useful ,if not leave it ..
function shortenurl($url){
if(strlen($url) > 45){
return substr($url, 0, 30)."[...]".substr($url, -15);
}else{
return $url;
}
}
may be useful ,if not leave it ..