We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How can I retrieve the full URL from shortened url from bit.ly

Loganathan Natarajan
on
Medium Priority
367 Views
Last Modified: 2012-05-11
I am parsing some RSS feeds on my website and need to find the original url from  bit.ly urls. How can I find that?

for example the bit.ly url is like this,  http://bit.ly/dyT34dW0 .. i need this url expanded ..like this, http://www.test.com/test.html
Comment
Watch Question

Commented:
You can use bit.ly API
bitly API Documentation
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Gk

Commented:
You can use an http connection to get the redirect address for the short address. get the redirect address for the status 301 !
Gk

Commented:
if you dont have any username/ref key?

<textarea id="abc" style="width:300;height:100"></textarea>
<script>
      var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      //var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
        xmlhttp.open("POST","http://www.knowurl.com/y.php", true);
      xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
      xmlhttp.send("url=http://bit.ly/eyDUrC");
      xmlhttp.onreadystatechange=function()
        {
            if(xmlhttp.readyState==4 && xmlhttp.status==200)
               {
                  document.getElementById("abc").innerText = xmlhttp.responseText;
            }
            
      }

</script>
Most Valuable Expert 2011
Author of the Year 2014

Commented:
The example is a 404 page.  If you can give us a REAL, WORKING bitly URL, we might be able to give you back the PHP code that extracts the original URL.
Loganathan NatarajanLAMP Developer
CERTIFIED EXPERT

Author

Commented:
thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.