shorten('http://www.google.com'); ?>
ÇALIŞMA!
$currenturl = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
include('bitly.php');
$bitly = new bitly('myusername', 'myapikey');
print $bitly->shorten($currenturl);
ÇALIŞMA!
include('bitly.php');
$currenturl = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url = "somehashtag"
$shareurl = $currenturl . '#' . $url;
$bitly = new bitly('myusername', 'myapikey');
print $bitly->shorten($shareurl);
NOT ÇALIŞMA! Any idea why? If i print out the $shareurl i can see that it's a completely normal url that i could paste onto the normal bit.ly website.
Ben alamadım! Herhangi bir fikir? Bana yardımcı olabilir harika olurdu!
I've got one more question. I'm not much of an php expert, but I guess if I'm calling the bitly service with this line $bitly->shorten($shareurl); a few times it's not very performative.
$bitly = new bitly('myusername', 'myapikey');
print $bitly->shorten($shareurl);
Can't i just save this bitly request to a var and paste it where i need it. For instance I'm having a few sharing links where i'm always using this bitly link.
$output .= "… share this link <a href=" . 'mailto:?subject=hello&body=' . $bitly->shorten($shareurl) . ">via email?</a> <a href=" . 'http://www.facebook.com/sharer.php?u='. $bitly->shorten($shareurl) . '?t=hello' .">on facebook?</a> <a href=" . 'http://twitter.com/home?status=' . $bitly->shorten($shareurl) . ">on twitter?</a>";
Bu daha iyi bir yolu var mı? Bunun yerine bitly isteğinde üç kez yapıyor?