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
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.

Link to comment
Share on other sites

  • 4 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.