Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 663153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:27:29+00:00 2026-05-13T23:27:29+00:00

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

  • 0

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!


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 .= "&hellip; share this link <a href=" . 'mailto:?subject=hello&amp;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>";

Is there a better way to this? Instead of doing the bitly request three times?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:27:30+00:00Added an answer on May 13, 2026 at 11:27 pm

    I think you need to urlencode your hash character. Try

    $shareurl = $currenturl . urlencode('#') . $url;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using bitlyj snapshot jar to shorten URLs from the following link. http://code.google.com/p/bitlyj/downloads/list
i would like to shorten www.site.com/product/info/laptop to www.site.com/laptop I used RewriteRule ^(.+)$ /product/info/$1 but
I've seen various URL shortening sites which shorten a URL to something like: http://something.com/WWER3
I'm trying to shorten a URL using the http://goo.gl API with the following jQuery
I need to shorten wchar_t array. Example: wchar_t* email = Lname@domain.com; / * Somehow
I want to shorten this URL: 'http://localhost/school/readmore?id=2' (which has to be in quotes as
Possible Duplicate: Shorten the URL from example.com/page.php?var=letters to example.com/letters Using htaccess, is it possible
How would one shorten the following using ternary operators? if ((pos - maxPos) ==
How can I shorten the definition of my custom routes in Zend Framework? I
I'm trying to shorten a wordpress title to just the first word. For a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.