使用PHP获取Twitter的短url

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用PHP获取Twitter的短url相关的知识,希望对你有一定的参考价值。

If you work with Twitter, you probably use a url shortener such as tinyurl.com or bit.ly to share/post your favorite blog posts or important messages with links on the network. This snippet take your url as a parameter and returns a short url.
  1. <?php
  2. function getShortUrl($url){
  3. return file_get_contents('http://tinyurl.com/api-create.php?url='.$url);
  4. }
  5. ?>

以上是关于使用PHP获取Twitter的短url的主要内容,如果未能解决你的问题,请参考以下文章