Jump to content

connect to mysql through proxy server


lorddemos90

Recommended Posts

How exactly would I set up a connecton to mysql in php, but through a proxy server and a port #. 

 

proxy.shr.secureserver.net  on port 3128

 

I have no idea where to start, so Here's my code.

 

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_searchprg = "host.com";
$database_searchprg = "database";
$username_searchprg = "login";
$password_searchprg = "password";
$searchprg = mysql_pconnect($hostname_searchprg, $username_searchprg, $password_searchprg) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

Link to comment
https://forums.phpfreaks.com/topic/73658-connect-to-mysql-through-proxy-server/
Share on other sites

port 3128 is usually the sign of a HTTP squid proxy server.

In order to do this you would need to use a SOCKS proxy server.

 

A PHP class for using a SOCKS proxy can be found here ( http://www.phpclasses.org/browse/package/1822.html )

 

I think the cleanest way to do it would be to create a socket that's listening on the local host; connect to that address/port with php and make your mysql requests to that address. Then basically re-transmit that data using the SOCKS class and then return the results through the socket you have open.

  • 4 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.