sinaurl.cn和t.cn生成 据我所以可能一个数据库
例子如下:
新浪短t.cn链接http://t.cn/RCoz95D
新浪短sinaurl.cn链接http://sinaurl.cn/RCoz95D
这两个都是跳转到:https://www.52pojie.cn/
新浪sinaurl.cn的生成原理已经很清楚了
[PHP] 纯文本查看 复制代码
<?php $url = "要生成的长链接";print_r(sinaurl($url));function sinaurl($longurl) { $result = tcn($longurl); $result = substr($result,strripos($result,"/")+1); $result = 'http://sinaurl.cn/'.$result; if (!$result) { return '生成失败,请重试'; } else { return ($result); }}function tcn($site){ $url = 'http://service.weibo.com/share/share.php?url='.urlencode($site).'&title=ířÖˇťńČĄ&pic=&appkey='; set_time_limit(0); sleep(0.5); $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3314.0 Safari/537.36 SE 2.X MetaSr 1.0'); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt ($ch, CURLOPT_REFERER, "http://news.cctv.com/2019/04/02/ARTIFR5qnxs1fj0v7j3CqXPI190402.shtml"); curl_setopt($ch, CURLOPT_MAXREDIRS,3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); curl_close($ch); preg_match('#<em class="tag_text">(.*?)<\/em>#' , $result ,$wburl); return $wburl[1];}function curl_get($url){ $ch=curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn; R815T Build/JOP40D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/4.5 Mobile Safari/533.1'); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $content=curl_exec($ch); curl_close($ch); return($content);}?>
文件下载地址暂时未公布,需要的朋友请在下方留言,看到后会第一时间更新下载地址。
声明:本站所有资源均由网友分享,如有侵权内容,请在文章下方留言,本站会立即处理。