adf.ly api using


SUBMITTED BY: daniprog

DATE: Aug. 1, 2018, 3:15 p.m.

FORMAT: Text only

SIZE: 837 Bytes

HITS: 11747

  1. function adflyShortenURL($url, $uid, $key){
  2. $apiURL = 'http://api.adf.ly/api.php?';
  3. // api queries
  4. $query = array(
  5. 'key' => $key,
  6. 'uid' => $uid,
  7. 'advert_type' => 'int',
  8. 'domain' => 'adf.ly'
  9. );
  10. // full api url with query string
  11. $apiURL = $apiURL . http_build_query($query).'&url='.$url;
  12. // get data
  13. $ch = curl_init();
  14. curl_setopt($ch, CURLOPT_URL, $apiURL);
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  16. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false );
  17. $data = curl_exec($ch);
  18. curl_close($ch);
  19. return $data;
  20. }
  21. $uid = "11784699";
  22. $key = "7c096173f1775f61d461df24d1e76f63";
  23. $url = 'http://www.stepblogging.com';
  24. $return = adflyShortenURL($url, $uid, $key);
  25. //OUTPUT: http://adf.ly/1RlYlU

comments powered by Disqus