分享一下joyqi同学的一个脚本,用于短域名不能访问
发布时间:October 31, 2009
常常会遇到短域名不能访问的情况,joyqi同学写了一个脚本,解决这个问题。
<?php //copyleft by joyqi.com $url = isset($_GET['url']) ? $_GET['url'] : exit(); $parts = parse_url($url); if ('http' == $parts['scheme']) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); if (preg_match("/location:[ ]+[^\r\n]+/is", curl_exec($ch), $out)) { header($out[0]); } curl_close($ch); }
使用:
1、保存成一个php文件,比如jump.php
2、上传到目录,比如http://sample.test.com/jump.php
3、访问http://sample.test.com/jump.php?url=http://sample.ly/fffff