Home > PHP > url minimizing and maximizing

url minimizing and maximizing

here is some interesting php code i have found from many of my resources,where i often goes for help like forums,blogs and others.This script helps you to make ur url tiny when you need to make ur url safe from bad guys.And also you can get ur real url using this script.Here it is

<?php
/* This function send a
request to http://tinyurl.com/api-create.php with your real
url and return a tiny new url
*/

function tiny_url($url){
return file_get_contents("http://tinyurl.com/api-create.php?url=" . $url);
}
$real_url = "http://www.yoururl.com/index.php";
$new_url=tiny_url($real_url);//now echo it if want to see
echo $new_url;

/* you can also expand this
url to real url by using
*/

function real_url($tiny)
{
$real = get_headers($tiny,1);
return $real;
}
$tiny="http://tinyurl.com/l9vmcf";// you just place here what you've got in $new_url

$real_one=real_url($tiny);

echo $real_one['Location'];
?>

Advertisements
Categories: PHP
  1. shahed
    July 2, 2009 at 9:24 am

    That’s awesome tips man awesome,thanks

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: