How can we create a program to visit a website through a proxy server?

CURL is probably the easiest solution. Here is an example using cURL. You can read more about it here.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.example.com');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, 'fakeproxy.com:1080');
curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'user:password');
$data = curl_exec();
curl_close($ch);

I was using a proxy ip instead of the domain name. But it does not work for me.

I could never get it to work myself, but as far as I know, this is the only option there is. Let me know if you can get it to work.

Hey,

1. What is the result that you got?
2. Add

$data = curl_exec() or die("Curl exe failed");

to check out the error.
3. Do print_r($data); and look at the response.

The following is the code that i had used

$ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, 'http://www.myurl.com');
       curl_setopt($ch, CURLOPT_HEADER, 1);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
       curl_setopt($ch, CURLOPT_PROXY, '60.217.232.51:80');
      //curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'user:password');
      $data = curl_exec($ch) or die("Curl exe failed");
      curl_close($ch);

I got the output "Curl exe failed"

Hey,
Just try this,

$ch = curl_init();  
	  curl_setopt($ch, CURLOPT_URL, "http://www.google.com");  
	  curl_setopt($ch, CURLOPT_VERBOSE, 1);  
	  curl_setopt($ch, CURLOPT_PROXY, '***.***.*.***:****');
 
       // Turn off the server and peer verification (TrustManager Concept).  
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  
       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);  
     
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
       curl_setopt($ch, CURLOPT_POST, 1);  
       // Get response from the server.  
       $httpResponse = curl_exec($ch) or die("Curl exe failed");

When i use this code after making necessary changes in the proxy, there is no output on my browser. But my proxy is working properly when it is used in my browser.

So now the curl function is executed.Now replace the url with ur one and do the rquirements.