9 Star 58 Fork 32

hvwyl / circuitjs1-zh

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
shortrelay.php 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
hvwyl 提交于 2022-09-10 01:31 . no commit message
<?php
//
// This module acts as a relay to any URL shortener with a suitable API
// update API call as needed if using API other than tinyurl.com
//
//
$serveraddr='http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}";
$s=parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$path= str_replace('shortrelay.php','circuitjs.html',$s);
$ch = curl_init();
// encode entire url. tinyurl won't decode the url unless the entire thing is urlencoded.
// we need to encode it because otherwise tinyurl gives us an error if the url includes %0A's (which it always does)
$v=urlencode($serveraddr . $path . $_GET["v"]);
curl_setopt($ch, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url='. $v);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
// echo $serveraddr . $path .$v;
exit;
?>
1
https://gitee.com/hvwyl/circuitjs1-zh.git
git@gitee.com:hvwyl/circuitjs1-zh.git
hvwyl
circuitjs1-zh
circuitjs1-zh
master

搜索帮助