MySQL_Narb Posted July 13, 2013 Share Posted July 13, 2013 (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. Quote Link to comment Share on other sites More sharing options...
.josh Posted July 13, 2013 Share Posted July 13, 2013 Your code doesn't show that you're even checking for errors. In your other thread I gave you some tips for looking at errors and header info returned from the curl calls.. Have you tried that? What does it output? Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted July 13, 2013 Author Share Posted July 13, 2013 (edited) Your code doesn't show that you're even checking for errors. In your other thread I gave you some tips for looking at errors and header info returned from the curl calls.. Have you tried that? What does it output? Sorry, usually soon as I post my problems I come up with a fix afterwards (should probably wait longer, but yeah). I'm using the built in error function in the CURL class. Added this bit: $errors = $this->curl->error(); print_r($errors); And that was my interesting result. There's no way these are all failing; I just double checked in a proxy checking problem...and quite a bit returned working. Edited July 13, 2013 by MySQL_Narb Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted July 13, 2013 Author Share Posted July 13, 2013 It seems as if the cURL option for the PROXY just doesn't work at all. I tried this with just a regular setup. <?php $ch = curl_init('http://www.google.com'); curl_setopt($ch, CURLOPT_PROXY, '123.103.23.106:20400'); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_exec($ch); print_r(curl_getinfo($ch)); curl_close($ch); ?> And it still returned nothing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.