跳至内容
Python 俱乐部
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
php:tcn-code
====== t.cn 短网址生成代码 ====== <code> <html> <head> <title>t.cn url shorten</title> </head> <body> <form method="post"> Long Url: <input type="text" size="100" name="url"> <input type="submit" value="Shorten"> </form> <?php function shortenSinaUrl($long_url){ $apiKey='****'; $apiUrl='http://api.t.sina.com.cn/short_url/shorten.json?source='.$apiKey.'&url_long='.$long_url; $response = file_get_contents($apiUrl); $json = json_decode($response); return $json[0]->url_short; #return $response; #return $c; } ?> <?php $long_url = $_REQUEST['url']; if ($long_url) { $tcn_url = shortenSinaUrl($long_url); echo "Short Url is: " . $tcn_url; echo "<br />"; echo "Long Url is: " . $long_url; } ?> </body> </html> </code>
php/tcn-code.1489400823.txt.gz
· 最后更改: 2017/03/13 10:27 由
admin
页面工具
显示页面
修订记录
反向链接
回到顶部