function adflyShortenURL($url, $uid, $key){
$apiURL = 'http://api.adf.ly/api.php?';
// api queries
$query = array(
'key' => $key,
'uid' => $uid,
'advert_type' => 'int',
'domain' => 'adf.ly'
);
// full api url with query string
$apiURL = $apiURL . http_build_query($query).'&url='.$url;
// get data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false );
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$uid = "11784699";
$key = "7c096173f1775f61d461df24d1e76f63";
$url = 'http://www.stepblogging.com';
$return = adflyShortenURL($url, $uid, $key);
//OUTPUT: http://adf.ly/1RlYlU