(note: cURL is installed on my webhost)
Useful cURL class I'm using: http://paste2.org/3weaghkm
public function testNewProxies($file, $max_time = 5){ $proxies = file_get_contents($file); $proxies = explode(PHP_EOL, $proxies); $fresh = array(); foreach($proxies as $proxy){ $this->curl->addSession('http://www.google.com', array( CURLOPT_TIMEOUT => 10, CURLOPT_RETURNTRANSFER => true, CURLOPT_PROXY => $proxy )); } $results = $this->curl->exec(); $this->curl->clear(); print_r($results); //check for fresh proxies for($i = 0; $i < count($proxies); $i++){ if(strpos($results[$i], 'removed')) $fresh[] = $proxies[$i]; } //write fresh proxies to new file $fh = fopen('proxies/proxies_checked_'.time().'.txt', 'w+'); foreach($fresh as $proxy){ fwrite($fh, $proxy.PHP_EOL); } fclose($fh); return count($fresh); }
The above function will run a file full of proxies and test them to see if they're good for use; however, nothing is ever returned. No errors or any data at all is returned in $results.
I always get this:
or
Any ideas and/or solutions?
Thank you.