Hey guys, I need software that will use a proxy to connect to a URL. I'm not making a proxy browsing script, nor anything illegal. I just need it for testing purposes. Anyone know how to do this simply inside of PHP? Thanks in advance, Scott
You can use cURL. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://your-url.com'); curl_setopt($ch, CURLOPT_PROXY, 'your-proxy-server'); curl_setopt($ch, /*other options you need */); PHP: www.php.net/curl
If you have no curl, you can use file_get_contents + stream_context_create: <? $opts = array('http' => array('proxy' => 'tcp://proxyserver:80', 'request_fulluri' => true)); $context = stream_context_create($opts); $s = file_get_contents('http://www.google.com', false, $context); echo $s; ?> PHP:
sorry for the revival, but how can I have that script read a list of proxies? i do not want an array, but rather to read a list of proxies from a txt file
<?php $proxyfile = "proxies.txt"; $fh = fopen($proxyfile, "r"); if($fh) { while(!feof($fh)) { $proxies = fread($fh, filesize($proxies)); } fclose($fh); } print $proxies; ?> PHP: I think that should do it. Didn't test it though. Let me know. Scott