bitly php url wont work???

Posted by mathiregister on Stack Overflow See other posts from Stack Overflow or by mathiregister
Published on 2010-03-11T20:38:31Z Indexed on 2010/03/11 20:44 UTC
Read the original article Hit count: 238

Filed under:
|
|
|

Hi guys,

<?php 
include('bitly.php'); 
    $bitly = new bitly('myusername', 'myapikey'); 
    print $bitly->shorten('http://www.google.com');
?> 

WORKING!!!

$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);

WORKING!!!

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 WORKING!!!

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.

I don't get it! Any ideas? Would be great if you could help me!

© Stack Overflow or respective owner

Related posts about url-rewriting

Related posts about php