/dev/null &"); } exit(file_get_contents($cache)); } // If the script was called locally we need to update the cache. Get all the anonymous proxy list pages. $pnum = 0; while ($pnum <= $maxpnum){ $page .= curl_func("http://www.xroxy.com/proxylist.php?type=Anonymous&pnum=$pnum"); preg_match_all('/pnum=(\d+)/', $page, $matches); $link = array_pop($matches[1]); $maxpnum >= $link or $maxpnum = $link; $pnum++; } // Match the IP and port. preg_match_all('/&host=((?:[0-9]{1,3}\.){3}[0-9]{1,3})&port=(\d+)/', $page, $matches, PREG_SET_ORDER); // Check if the proxy is accepting connections and if so, add it to the list foreach($matches as $row){ if ($fp = @fsockopen($row[1], $row[2], $errno, $errstr, 5)){ fclose($fp); $text .= "{$row[1]}:{$row[2]}\n"; } } file_put_contents($cache, $text); ?>