我正在制作的代理有问题

时间:2019-10-08 03:17:54

标签: regex file-get-contents php-7.2

基本上,我为此使用repl.it,他们实现了一个新的Web服务器,但遗憾的是它没有卷曲,这意味着我必须使用file_get_contents。 file_get_contents()有效,但是问题是,我不想代理google.com,但结果却给了我,代理无法到达,因为它将要求它先添加(localdomain和文件夹),然后添加url

有人知道我应该添加到代码中的任何内容吗? 如果您不了解,我也将进行解释,这对stackoverflow是新手。

代码:

<?php 
define("PROXY_PREFIX", "http" . (isset($_SERVER["HTTPS"]) ? "s" : "") . "://" . $prefixHost . $prefixPort . $_SERVER["SCRIPT_NAME"] . "?");
$domain = 'https://homeworkfor204.tuesdaycat.repl.co/';
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  $redirect = base64_encode($_POST['url']);
  header('location: '.$redirect);
}
$url_regex = '/.*/';

if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') 
    $url = "https"; 
else
    $url = "http"; 
$url .= "://"; 
$url .= $_SERVER['HTTP_HOST']; 
$url .= $_SERVER['REQUEST_URI']; 
$pos = strrpos($url, '/');
$orgurl = $url= $pos === false ? $url : substr($url, $pos + 1);
$proxyprefix = $domain."proxifier".$orgurl."/";
$url = base64_decode($url);
function get_string_between($string, $start, $end){
    $string = ' ' . $string;
    $ini = strpos($string, $start);
    if ($ini == 0) return '';
    $ini += strlen($start);
    $len = strpos($string, $end, $ini) - $ini;
    return substr($string, $ini, $len);
}

if (empty($url)){
  ?> 

  <form action = "" method = "post">
  <input type = "text" placeholder = "https://probably.google.com" name = "url">
  <input type = "submit" value = "proxify">

  <?php
}
// check $bodytag = str_replace("%body%", "black", "<body text='%body%'>");
else{
  $source = file_get_contents($url);
  $source = '<!-- Proxified by Octoboys Proxy -->'.$source;
  echo $source;
}

?>

任何事情都会受到赞赏。

0 个答案:

没有答案