I want to use curl with the proxy feature. I've implemented the script below successfully but there is one issue with it. The test.php is under the radar (using a proxy) but not the following links / iframes, etc. I'm using a link on test.php - when I click on it, it's not using the proxy. I'm importing an iframe (from another server) - it's not using the proxy.
How can I implement the script that EVERYTHING is using a proxy? That everything goes through the proxy (doesn't matter whether it's a link or an iframe or coming from somewhere)
Thanks a lot for help!
Code: Select all
<?
include("connect_database.php");
// select random proxy from database
$result = mysql_query("SELECT server_ip, server_port FROM proxies ORDER by RAND() LIMIT 1");
$proxy_list = mysql_fetch_assoc($result);
$proxy = $proxy_list['server_ip'] . ":" . $proxy_list['server_port'];
$ch = curl_init("http://www.xypage.com/test.php");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
$data = curl_exec($ch);
echo $data;
?>