
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 1.02 KB | hits: 3 | expires: Never
<?php
function get_content($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/10.04 (lucid) Firefox/3.6.12");
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
$content = get_content("http://www.mrhinkydink.com/proxies.htm");
$toclean = array();
if (preg_match_all('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/', $content, $match)) {
foreach ($match[0] as $result) {
echo $result . "<br>\n";
}
} else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $content, $match)) {
$strip = strip_tags($content);
$pattern = '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
}
print_r($toclean);
?>