streams/Code/Module/Sslify.php

34 lines
792 B
PHP
Raw Normal View History

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;
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);
}
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
}