Can you set up such an agent website by yourself?

this website
http://anyorigin.com
provides proxies that can solve cross-domain problems.
now, can I do it with my own vps?

I will turn on the forward proxy of apache (reverse will also). How can I use php to match the client"s request on this vps, and the agent will forward it?
Please give me some clues.

client code

$.getJSON("http://anyorigin.com/go?url=https://www.cnblogs.com/not-alone/articles/8552251.html&callback=?", function(data){
$("-sharpoutput").html(data.contents);});
 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

The content i got with proxy

<p id="output">

I want to provide services on my domain name www.mydaomin.com so that the following code can run

$.getJSON("http://www.mydomain.com/go?url=https://www.cnblogs.com/not-alone/articles/8552251.html&callback=?", function(data){
$("-sharpoutput").html(data.contents);});
 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

The content i got with proxy

<p id="output">

May.22,2021

header('Access-Control-Allow-Origin: *');
if($_SERVER['REQUEST_METHOD'] == 'GET')
{
    echo file_get_contents($_GET['url']);
}
else
{
    //curl post
}
Menu