HELP with 5.gp API to dynamically shorten URLs

Discussion in 'Programming' started by Love*, Feb 19, 2012.

  1. #1
    NEVERMIND! I got it, used is.gd instead. :)

    Hi there, I'm having trouble figuring out how to do this.

    On my site, I have some dynamic links that I would like to automatically shorten using the 5.gp API.

    It's supposed to be very simple, you get a shortURL via:
    http://5.gp/api/short?longurl=MY_LINK.COM
    Code (markup):
    The shortened URL is the one next to "url" on that page.

    Right now, what I am doing to get this is:
    <a href="<?php print("http://5.gp/api/short?longurl=HTTP://MY_LINK.COM"); ?>">ANCHOR TEXT</a>
    PHP:
    But that is the wrong code, & I have googled the whole night for this.
    I can't figure out how to automatically fetch the short url. :(

    Can anyone help? I would really appreciate it. Thank you.
     
    Last edited: Feb 19, 2012
    Love*, Feb 19, 2012 IP