php网易免费短地址接口
利用网易免费短地址接口开发的短网址缩短服务 br / 演示地址: a target=_blank href=http://3.tbip.sinaapp.com/ rel=nofollowhttp://3.tbip.sinaapp.com//a br / 伪静态规则 br / RewriteEngine on br / RewriteRule ^(.*)$ in
利用网易免费短地址接口开发的短网址缩短服务
演示地址: http://3.tbip.sinaapp.com/
伪静态规则
RewriteEngine on
RewriteRule ^(.*)$ index.php?id=$1 [L]
演示地址: http://3.tbip.sinaapp.com/
伪静态规则
RewriteEngine on
RewriteRule ^(.*)$ index.php?id=$1 [L]
<?php ob_start('ob_gzip'); //gzip压缩 define('REWRITE', '0'); //是否启用伪静态 1为启用0为不启用 define('IS_SINA', '0'); //是否sina sae 1为启用0为不启用 define('API_KEY', '2e409ff7a967418aa5e4dd15051702ba'); //API key请自行申请 $weburl=getenv('SERVER_NAME').dirname(getenv('SCRIPT_NAME')); $weblink=REWRITE?"http://".$weburl."/":"http://".$weburl."/?"; if($_GET['url']){ $data=duanurl($_GET['url']); $shorturls=str_replace('126.am/',$weblink,$data->url); }else if(count($_GET)>0){ $headurl=getenv("QUERY_STRING");echo "<script>location.href='http://126.am/".$headurl."'</script>"; } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>网易免费短地址</title> <META NAME="Description" CONTENT="126,网易短地址,短网址,短域名,短网址程序,淘宝短网址,短网址转换,短网址还原,百度短网址"> <META NAME="Keywords" CONTENT="网易短地址,短网址,短域名,短网址程序,淘宝短网址,短网址转换,百度短网址,www.ibtf.net"> <link href="favicon.ico" type="image/ico" rel="shortcut icon"> <style> a:link {color:#666;} a:visited {text-decoration: none;color: #333;} a:hover {text-decoration: none; color: #333;} a:active {text-decoration: none;color: #CCC;} body{margin:0px;background:url(bg_body.jpg) repeat-x;height:100%;text-align: center;} .warp{margin:0 auto;width:620px;}img{border:none;}.c{clear:both;}.l{float:left;}.r{float:right;}ul,li{list-style:none;} .main{margin:0 auto;width:620px;} .logo{margin:20px auto;text-align:center;} .logo a{font-size:50px} .main p{text-align:center;color:#999;font-size:14px;} .area{padding:10px;background:#f1f7f8;border:1px solid #cfe0e0;} .text_are{float:left;width:440px;height:36px;padding:5px 0;border:1px solid #c6c6c6;font-size:16px;background:#ffffe6;} .text_btn{float:left;margin-top:-1px;width:86px;height:36px;border:1px solid #c6c6c6;background:#f8f8f8;} .list{float:left;margin-top:-1px;padding:9px;border:1px solid #cfe0e0;background:#FFF;font-size:12px;color:#999;} .list td{padding:3px 5px;border-bottom:1px solid #e1edef;height:30px;} .more a{color:#333;text-decoration:none;} .footer{margin-top:15px;font-size:11px;color:#CCC;text-align:center;} </style> </head> <body> <div class="warp"> <div class="main"> <div class="logo"><a href="<?=$weburl?>" title="网易免费短地址">网易免费短地址</a></div> <p>缩短、分享及监测你的链接 </p> <div class="content" id="list" > <div class="area"> <form action="" method="get" id="post_form"> <input name="url" type="text" class="text_are" id="short_url" value="http://"/> <input type="submit" class="text_btn" value="立即缩短"/> </form> <div class="c"></div> </div> <div class="list" style="width: 600px;"> <table width="600" border="0" cellpadding="0" cellspacing="0" id="list_url"> <tr> <td bgcolor="#e4e4e4">短链接</td> <td bgcolor="#e4e4e4">原始网址</td> </tr> <tr> <td> <?php echo '<a href="'.$shorturls.'" target="_blank"><b>'.$shorturls.'</b></a></td>'; echo '<td>'.$_GET['url'].'</td>'; ?> </tr> </table> </div> <div class="signdes"> <script type="text/javascript"><!-- google_ad_client = "ca-pub-2006512290696014"; /* 468x60 */ google_ad_slot = "6662313368"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> </div> </div> </div><div align="center"> <div class="bdlikebutton"></div> <script id="bdlike_shell"></script> <script>var bdShare_config = {"type":"large","color":"blue","uid":"533431","share":"yes"}; document.getElementById("bdlike_shell").src="http://bdimg.share.baidu.com/static/js/like_shell.js?t=" + new Date().getHours(); </script></div> <div class="footer"> <!--友情链接--> <a href="http://www.ibtf.net" target="_blank">爱比特福</a> <a href="http://www.bitefu.net" target="_blank">比特福精品汇</a> <a href="http://tbip.sinaapp.com" target="_blank">IP查询 </a> </div> <div style="display:none"><script language="javascript" type="text/javascript" src="http://js.users.51.la/3729735.js"></script></div> </body> </html> <?php //gzip压缩 function ob_gzip($content){ if(!headers_sent()&&extension_loaded("zlib")&&strstr($_SERVER["HTTP_ACCEPT_ENCODING"],"gzip")){ $content = gzencode($content,9); header("Content-Encoding: gzip"); header("Vary: Accept-Encoding"); header("Content-Length: ".strlen($content)); } return $content; } function duanurl($url) { if(IS_SINA){ $f = new SaeFetchurl(); $f->setMethod("post"); $f->setPostData(array("key"=>API_KEY,"longUrl"=>$url)); $content=$f->fetch("http://126.am/api!shorten.action"); if($f->errno() == 0) { $return =$content; }else{$return = $f->errmsg();} }else{ $ch=curl_init(); curl_setopt_array( $ch, array( CURLOPT_URL=>'http://126.am/api!shorten.action', CURLOPT_RETURNTRANSFER=>true, CURLOPT_POST=>true, CURLOPT_POSTFIELDS=>'key='.API_KEY.'&longUrl='.$url )); $content=curl_exec($ch); if(curl_errno($ch)) $return=curl_error($ch); else $return=$content; curl_close($ch); }return json_decode($return); }ob_end_flush(); ?>
精彩图集
精彩文章