Reputation: 48535
Let's say i got a vps hosting with a dedicated ip, can i make a curl php script that receives a url, fetch it, and output it, and make all this as a proxy server, so i can put my vps ip in the proxy settings of the browser.
Is there any way to do that?
Note: Please don't suggest me a web based proxy like glype.
Thanks
Upvotes: 9
Views: 27519
Reputation: 2027
You're wrong at what are you asking. You ask about PHP script, but don't like the Glype. There are at least 4 more PHP's proxy developments.
But in fact, no one will let you connect your browser with it, because you need to implement the tcp wrapper for the connection. This is the way you got usually an http interface with cURL or direct raw socket.
You need an SO app, not an script.
I would recommend you Squid proxy for Linux (handy and clean manual http://es.kioskea.net/faq/613-instalar-un-servidor-proxy-http-squid) I would recommend you to not use Windows (even if i do), but the FreeProxy is awesome. (download at http://www.softpedia.com/get/Internet/Servers/Proxy-Servers/FreeProxy.shtml)
On the other hand of the proxy, you got the VPN. It's better and easier to install and connect to a VPN, a private SSH protected private network to your VPS. That will bypass ALL the traffic from your computer through a encrypted connection to/from the VPS.
You will have the VPS's IP, and "local" connectivity to your VPS/Desktop from both sides. (example, web servers with no need of open ports except the VPN one)
Upvotes: 1
Reputation: 31
You can use tor proxy, here is the script:
<?php
function tor_new_identity($tor_ip='127.0.0.1', $control_port='9051',$auth_code='saad'){
$fp = fsockopen($tor_ip, $control_port, $errno, $errstr, 30);
if (!$fp) return false; //can't connect to the control port
fputs($fp, "AUTHENTICATE $auth_code\r\n");
$response = fread($fp, 1024);
list($code, $text) = explode(' ', $response, 2);
if ($code != '250') return false; //authentication failed
//send the request to for new identity
fputs($fp, "signal NEWNYM\r\n");
$response = fread($fp, 1024);
list($code, $text) = explode(' ', $response, 2);
if ($code != '250') return false; //signal failed
fclose($fp);
return true;
}
?>
Call the function "if (tor_new_identity('127.0.0.01', '9051')) {//do stuffs here}
"
But you must install the tor system in the VPS 1st.
Upvotes: 1
Reputation: 146134
You can check out this PHP proxy that uses cURL. It's not perfect (I'm in the process of fixing it to handle PUT requests, application/json POSTS, etc). The thing is you'll need to configure the web server to rewrite all requests to this file's file name so you can proxy them properly.
Upvotes: -1
Reputation: 97835
Use Apache with mod_proxy
and mod_proxy_http
. See the docs.
You can access the proxy through https, effectively encrypting all your traffic between your computer and the VPS.
Upvotes: 1
Reputation: 7611
Yes, you could (see Jasper's answer). That would be effectively making your own web-based proxy.
However, given that it's a VPS, I would suggest using a SSH SOCKS proxy, since it'll be easier and will be running through an encrypted tunnel to the VPS.
Upvotes: 1