短地址TinyURL的API使用

TinyURL的短地址服务超过10年了,很稳定,官方没有给出API连接,其实很简单:

API: 调用:http://tinyurl.com/api-create.php?url=http://URL,  你可以发送一个request到这个地址, Response中只有一个字符串,就是你的短地址URL; 

php例子:

/**
 * 获取短地址
 * [@param](/user/param) $url 需要处理的长地址
 * [@return](/user/return) string
 */
private function getQrCodeUrlByTinyURL($url) {
    $response=file_get_contents ("http://tinyurl.com/api-create.php?url=".$url);
    return $response;
}

  

原文地址:https://www.cnblogs.com/8765h/p/5377965.html