I own some websites and do some web development work. However I'm trying to create a method whereby I can create a web page on my server that I can use to surf other websites. There's several reasons for this - hiding my IP, security, bypassing firewalls and so on.
I can't use iFrame, because the content still downloads to the local device. What I want is a solution that downloads the website to the server, renders it and displays it on my webpage, so all content is fed directly from my server. It would be like a browser inside a webpage.
Can someone help me how this can be done? I can do some basic web coding which may help, I don't need it to be fancy, just something simple and basic.
2 Answers
If you have administrative access to the server an HTTP relay will do what you want.
You can use Socat
socat TCP4-LISTEN:www TCP4:
installs a simple TCP port forwarder. WithTCP4-LISTEN it listens on local port "www" until a connection comes in, accepts it, then connects to the remote host (TCP4) and starts data transfer. It will not accept a econd connection.
socat -d -d -lmlocal2 \ TCP4-LISTEN:80,bind=myaddr1,su=nobody,fork,range=10.0.0.0/8,reuseaddr \ TCP4:
TCP port forwarder, each side bound to another local IP address (bind). This example handles an almost arbitrary number of parallel or consecutive connections by fork'ing a new process after each accept() . It provides a little security by su'ing to user nobody after forking; it only permits connections from the private 10 network (range); due to reuseaddr, it allows immediate restart after master process's termination, even if some child sockets are not completely shut down. With -lmlocal2, socat logs to stderr until successfully reaching the accept loop. Further logging is directed to syslog with facility local2.
See also
I managed to get this sorted... ish. It's crude but it works, although sometimes the page is delivered in plain text. For my purposes though, that's not a problem.
Here's my solution using the file_get_contents PHP function a two page process.
Contents of index.php:
<body>
<h1>browser</h1>
/* gets the data from a URL */
?>
<form action="/webb/browse.php" method="post">
url: <input type="text" name="url"><br>
<input type="submit">
</form>
Welcome <?php echo $_POST["url"]; ?><br>
</body>
Contents of browse.php
<body>
<h1>browser</h1>
/* gets the data from a URL */
?>
<form action="/webb/browse.php" method="post">
url: <input type="text" name="url"><br>
<input type="submit">
</form>
url - echo $_POST["url"]; ?><br>
<?php
$url = $_POST["url"];
$homepage = file_get_contents('h'.$url);
echo $homepage;
?>
</body>
If anyone cares to refine it they're welcome but this works for me!