/**
* Adfly Url Shortener PHP API
*
* @param string $url http://www.google.com
* @param string $key 7abccd03cc3005835cc61dd956b583ca
* @param int $uid 1234
*
* @param string $advert_type (optional) int || banner
* @param string $domain (optional) adf.ly || q.gs
*/
function adfly($url, $key, $uid, $domain = 'adf.ly', $advert_type = 'int')
{
// base api url
$api = 'http://api.adf.ly/api.php?';
// api queries
$query = array(
'key' => $key,
'uid' => $uid,
'advert_type' => $advert_type,
'domain' => $domain,
'url' => $url
);
// full api url with query string
$api = $api . http_build_query($query);
// get data
if ($data = file_get_contents($api))
return $data;
}
// Your api key
$apiKey = '7abccd03cc3005835cc61dd956b583ca';
// Your user id
$uId = 1234;
$buton = $_POST["buton"];
if($buton=="Kısalt"){
$url = $_POST["url"];
if($url==""){
echo '
Lütfen Boş Bırakmayınız
';
}else{
echo adfly($url,$apiKey,$uId);
}
}
?>
Bu da demosu :) http://adf.ly/pDL0p