A programming & designing blog!

Responsive Ads Here

Thursday, October 3, 2013

Adfly URL Shortener PHP API

Now days, Adfly is one of the most popular url shortener service on the web. The best thing of this service is that you can earn money through this service and it is the main reason of it's popularity. Nowadays it is providing simple api to made this service more easy.

In this post you will show how we can make short url using Adfly api and PHP.

Step 1 - Get Your Adfly API Key & User ID

To use Adfly API at first you need to get your API key and your user id. If you are a Adfly member you can get these by following way..

Go to http://adf.ly/publisher/tools#tools-api

Here you will fond a link something like this..


Here 7abccd03cc3005835dc61dd956b583ca is your API key and 111111 is your user id.

Step 2 - Adfly PHP Function

 * Adfly Url Shortener PHP API
 * @param string $url http://www.google.com
 * @param string $key 7abccd03cc3005835cc61dd956b583ca
 * @param int $uid 1234
 * @param string $advert_type (optional) int || banner
 * @param string $domain (optional) adf.ly || q.gs
function adfly($url, $key, $uid, $domain = 'adf.ly', $advert_type = 'int')
  // base api url
  $api = 'http://api.adf.ly/api.php?';

  // api queries
  $query = array(
    'key' => $key,
    'uid' => $uid,
    'advert_type' => $advert_type,
    'domain' => $domain,
    'url' => $url

  // full api url with query string
  $api = $api . http_build_query($query);
  // get data
  if ($data = file_get_contents($api))
    return $data;


// Your api key
$apiKey = '7abccd03cc3005835dc61dd956b583ca';
// Your user id
$uId = 111111;

echo adfly('http://w3bees.com', $apiKey, $uId);




  1. Replies
    1. ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵
      ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵
      ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵ ͇͇̳̳̳̳̳͇̿̿͏҉͙͖͕͔͓͎͇͉͈͍͚͙͙͖҇͗͒͑͐̈́̓͊͋͌͛͗ͫͮͯ͘͘͟͜͡͠͞͝ͅʹ͵

  2. Hi there, do you think is possible to integrate it with a download manager script ?

  3. Its very good. Thanks for sharing this.

  4. Thanks for sharing this post to us. This is really informative about computers.

  5. This comment has been removed by the author.

  6. This comment has been removed by the author.

  7. ok. On my server allow_url_fopen is disabled. Maybe have another alternative with curl?

  8. How can i add a text field and a submit button with this?

    This would allow me to enter links in a text box, click submit and adfly links will be returned.

  9. Thanks for sharing informative article!!! Your article helped me a lot to understand the importance of PHP Training Center in Chennai to secure lucrative job in web design and development industry.

  10. Thanks for that.You sharing very helpful information..It's really understand for PHP Developer..

    Informatica Training in Chennai | Oracle DBA Training in Chennai

  11. Hello, Can anyone help me about the career path and chances in choosing PHP? I have planned to do PHP Training in Chennai. Someone suggest where to join for the best PHP Training in Chennai where I could also get placement services?

  12. This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic.
    Python Training in Chennai|Python Training|Python Training Institutes in Chennai

  13. Very nice piece of article which can help many developers, thank you for sharing your knowledge with us. Keep sharing.
    PHP training in Chennai||PHP course in Chennai ||PHP training institute in Chennai

  14. The main thing which i like about web designing is that itneeds creativity and we need to work differently acccording to our clients need this needs a creativity and innovation.
    web designing course in chennai|web designing training in chennai|web designing courses in chennai

  15. After the website s completed it is very impoprtant to market it. Be it a brand or a website, if you want to reach a large audiece then effective marketive should done and this can be achieved by SEO.
    Seo training in chennai|Seo training|Seo courses in chennai|Seo training chennai

  16. As the world is constantly getting advanced digitally for every brand or a company it is very important to mark their presence online. not only to mark their presence they also have to be very active on the web so that they can have a conversation with their clients/customers and solve their problems or improve their service.
    Digital Marketing Training in Chennai|Digital Marketing Course in Chennai|Digital Marketing Chennai

  17. Hi author I actually teach web designing, and after I read this article I was able to clarify a doubt and this helped me understanding a certain concept better and so I could teach my students well. Thank you.
    web designing course in chennai|web designing training in chennai

  18. Hi, actually I'am new to angularJs and infact I'am learning angularjs with online training. I'am having doubt, if you could solve the doubt for me that would be very helpful. The doubt is, how can I reset a “$timeout”, and disable a “$watch()”?
    angularjs training in Chennai|angularjs course in Chennai|Fita Chennai reviews

  19. If you are willing to develop a website but you dont know web development or coding then relax wordpress CMS platform is just for you. Where you can create website all by yourself.
    wordpress training in chennai | Wordpress course in chennai | FITA Academy reviews

  20. Best Java Training Institute In ChennaiThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

  21. Quite informative post on AdFly URL shortener!!
    PHP Training in Chennai

  22. very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information in this blog
    informatica Training in Chennai

  23. what a great post with lots of apps thanks for helpful sharing..Buzz Applications

  24. In India thenumber of smartphone users have been on a rise. Among them also the people using android is way to high. Being an android developer would be the dorrect career choice.
    Android training in Chennai | Android course in Chennai | Android training institute in Chennai

  25. nice sharing..
    Best SEO training in hyderabad all modules are clearly solved and practice with guide.seo training in hyderabadAnd clearly getting knowledge of seo.

  26. Thanks for sharing this informative content that guided me to know the details about the training offered in different technology.
    digital marketing course in chennai | digital marketing training in Chennai

  27. nice! thank you so much! Thank you for sharing. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me.

  28. Are you looking to make cash from your visitors by popup advertisments?
    In case you do, did you ever use Pop Cash?

  29. Did you know you can create short links with OUO and get dollars from every click on your shortened links.

  30. 100% Job Oriented R Programming Training In Chennai for more Information click to the best msbi training in chennai

  31. 100% Job Oriented R Programming Training In Chennai for more Information click to the best cloud-computing training in chennai

  32. Extremely enlightening substance. Digital marketing is the best to promote our product. We mainly focus on SMO and SEO in digital marketing. The main task is to analyze the keyword and to bring the site at the top position for particular keyword.
    Digital Marketing Training in Chennai | Digital Marketing Chennai | Digital Marketing courses in Chennai

  33. Thanks for sharing this informative articles.
    Keep updating more:)

    Best Spring Training in Chennai

  34. 100% job oriented training & placements in chennai.
    Best software training in chennai.
    Best software training in chennai

  35. Thanks for posting this useful content, Good to know about new things here, Let me share this,
    AngularJS Training in Chennai | AngularJS Training | Best AngularJS Training Institute in Chennai

  36. This comment has been removed by the author.

  37. “Bác sĩ.” Tả Phán Tình nuốt nước miếng, ngẩng đầu nhìn bác sĩ kiên quyết mở miệng: “Tôi muốn bác sĩ giúp tôi bỏ đứa bé này.”
    “Cái gì?” Bác sĩ sửng sốt một chút, cô sở dĩ ấn tượng sâu sắc với Tả Phán Tình là bởi vì vẻ lo lắng, sầu lo trong mắt Tả Phán Tình hôm Tiếng anh cho người đi làm
    Tiếng anh cấp tốc
    Luyện thi toeic tại hà nội
    Tiếng anh cho người lớn tuổi
    Tiếng anh cho người mới bắt đầu
    Học tiếng anh tại hà nội
    dạy tiếng anh cho doanh nghiệpđó, lúc đó cô lo lắng sợ đứa bé có chuyện. Vì sao bây giờ lại muốn bỏ đứa bé?
    “Cô ơi, cô nói gì vậy?”
    “Tôi nói, cô giúp tôi bỏ đứa bé này đi.”

  38. Get daily ideas and methods for making THOUSANDS OF DOLLARS per day ONLINE for FREE.

  39. Thanks for posting this useful content, Good to know about new things here, Let me share this,
    AngularJS Training in Chennai | AngularJS Training | Best AngularJS Training Institute in Chennai

  40. Hello,
    Could you provide an adfly daily payment request PHP function? I've combed through the entire API docs, but all I could find was data, not requests.

  41. Thanks for posting this useful content, Good to know about new things here, Let me share this, Best Angularjs Training in Chennai |
    AngularJS Training in Chennai

  42. thanks for sharing bro.. i really need this article. thank you

    Cara Flash Android

  43. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it. Selenium Training Institute in Chennai | Selenium Training Institute in Velachery

  44. I read about for this feature for Android developers and it's I can to be designed for the future data list.I used their eliminator database of Android improved I like this article now.Thanks for the very gradually information.I book for the website for my bookmark.Selenium Training in Chennai | Selenium Testing Training in Chennai

  45. Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
    www.mcdonaldsgutscheine.net/ | www.startlr.com/ | www.saludlimpia.com/

  46. Thanking you for given this information.I very much enjoyed this article. more openings php jobs in hyderabad.

  47. It is a very nice article including a lot of viral content. I am going to share it on social media. Get the online crackers in chennai.

  48. I’ve been browsing on-line greater than three hours today, but I never discovered any attention-grabbing article like yours. It is beautiful worth sufficient for me. Personally, if all webmasters and bloggers made good content material as you did, the net will be a lot more helpful than ever before.
    Digital Marketing Company in Chennai
    SEO Company in Chennai

  49. Interesting post! This is really helpful for me. I like it! Thanks for sharing!
    office 2016 32 bit deutsch download

  50. Thank you for the writing a good article and it helps me a lot. Buy the Cold Pressed Oil in India.

  51. Adfly is really good
    AOC recruitment 2017 tradesman

  52. I found a lot of interesting information here. A really good post
    WebDesign Lüdenscheid

  53. Replies
    1. Great post.Thanks for one marvelous posting! I enjoyed reading it;The information was very useful. QTP Training in Chennai | Java Training in Chennai | Python Training in Chennai

  54. • Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online course

  55. This is very good blog for learners, Thanks for sharing valuable content on MSBI Online Training

  56. It was so good to read and useful to improve my knowledge as updated one.Thanks to Sharing.
    PHP Online Training | Pega Online Training | Oracle Soa Online Training

  57. I enjoy what you guys are usually up too. This sort of clever work and coverage! Keep up the wonderful works guys I’ve added you guys to my blog roll..,

    white label website builder

    mobile website builder

  58. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    aws training in Chennai

  59. I have read your blog. Your information is really useful for beginner. informations provided here are unique and easy to understandThanks for this useful infromation.
    Selenium Training in Chennai |Oracle Training in Chennai

  60. Those guidelines additionally worked to become a good way to
    recognize that other people online have the identical fervor like mine
    to grasp great deal more around this condition.

    white label website builder