I have a problem with a proxy I am making

Basically, I am using repl.it for this, they implemented a new Web Server but sadly it does not have curl, which means that I have to use file_get_contents. file_get_contents() works but the problem is, let's say I wan't to proxy google.com, but the result gives me , which the proxy can't get to because it would require it to add (localdomain and folder) then the url.

does anybody know anything I should add to my code to do that? I will also explain anything if you do not understand it, I am new to stackoverflow.

code:

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

?>

Anything will be appreciated.