2016-04-19 03:38:38 +00:00
|
|
|
<?php
|
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
namespace Code\Module;
|
2016-04-19 03:38:38 +00:00
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
use Code\Web\Controller;
|
2022-06-23 07:38:34 +00:00
|
|
|
use Code\Lib\Url;
|
2021-12-02 22:33:36 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class Sslify extends Controller
|
|
|
|
{
|
2016-04-19 03:38:38 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
public function init()
|
|
|
|
{
|
2022-08-30 05:31:40 +00:00
|
|
|
$url = $_REQUEST['url'];
|
|
|
|
if ($url) {
|
|
|
|
$x = Url::get($url);
|
|
|
|
if ($x['success']) {
|
|
|
|
$h = explode("\n", $x['header']);
|
|
|
|
foreach ($h as $l) {
|
|
|
|
list($k, $v) = array_map("trim", explode(":", trim($l), 2));
|
|
|
|
$hdrs[strtolower($k)] = $v;
|
|
|
|
}
|
|
|
|
if (array_key_exists('content-type', $hdrs)) {
|
|
|
|
$type = $hdrs['content-type'];
|
|
|
|
header('Content-Type: ' . $type);
|
|
|
|
}
|
2016-12-16 02:06:49 +00:00
|
|
|
|
2022-08-30 05:31:40 +00:00
|
|
|
echo $x['body'];
|
|
|
|
killme();
|
|
|
|
}
|
2021-12-02 23:02:31 +00:00
|
|
|
}
|
|
|
|
killme();
|
|
|
|
}
|
2016-04-19 03:38:38 +00:00
|
|
|
}
|