Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 3  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. function get_content($url) {  
  3.    $ch = curl_init();  
  4.  
  5.    curl_setopt ($ch, CURLOPT_URL, $url);  
  6.    curl_setopt ($ch, CURLOPT_HEADER, 0);  
  7.    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");
  8.    ob_start();  
  9.  
  10.    curl_exec ($ch);  
  11.    curl_close ($ch);  
  12.     $string = ob_get_contents();  
  13.  
  14.    ob_end_clean();  
  15.      
  16.    return $string;      
  17.  
  18. }
  19. $content = get_content("http://www.mrhinkydink.com/proxies.htm");
  20. $toclean = array();
  21. 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)) {
  22.         foreach ($match[0] as $result) {
  23.                 echo $result . "<br>\n";
  24.         }
  25. } else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $content, $match)) {
  26.         $strip = strip_tags($content);
  27.         $pattern = '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/';
  28.         $replacement = '${1}1,$3';
  29.         echo preg_replace($pattern, $replacement, $string);
  30. }
  31. print_r($toclean);
  32. ?>