24.143.198.188
:80
HTTP
250,890,890
United States
我想取出其IP和連接埠號碼;
主要是為了提取http://www.cnproxy.com/proxy1.html這個網頁上的Proxy 伺服器
24.143.198.188:80
37.57.20.143:3128
37.59.48.180:8118
回複討論(解決方案)
這不是簡但的正則就可完成的
比如
77.37.134.58HTTP188,907,922Russia
77.37.134.58 是伺服器ip
z+c+a+x 才是連接埠號碼,需要計算出真實值。
而這些 js 變數是在前面的
中賦值的
這不是簡但的正則就可完成的
比如
77.37.134.58HTTP188,907,922Russia
77.37.134.58 是伺服器ip
z+c+a+x 才是連接埠號碼,需要計算出真實值。
而這些 js 變數是在前面的
中賦值的 那我再看看,我是看到python中有實現這個功能,想試試php能做一個不。
def build_list_urls_6(page=3):page=page+1ret=[]for i in range(1,page):ret.append('http://www.cnproxy.com/proxy%(num)01d.html'%{'num':i})return retdef parse_page_6(html=''): matches=re.findall(r''' ([^&]+) #ip \:([^<]+) #port HTTP [^<]+ ([^<]+) #area ''',html,re.VERBOSE) ret=[] for match in matches: ip=match[0] port=match[1] type=-1 #該網站未提供Proxy 伺服器類型 area=match[2] if indebug:print '6',ip,port,type,area area=unicode(area, 'cp936') area=area.encode('utf8') ret.append([ip,port,type,area])return ret
但他的連接埠(port)取得也不對!
但他的連接埠(port)取得也不對! function parsePort($str)
{
$str = str_replace('document.write(":"', '', $str);
$str = str_replace(')', '', $str);
$str = str_replace('+x', '8', $str);
$str = str_replace('+f', '0', $str);
$str = str_replace('+z', '3', $str);
$str = str_replace('+c','1', $str);
$str = str_replace('+a','2', $str);
$str = str_replace('+i','3', $str);
$str = str_replace('+l','9', $str);
return ':'.$str;
}
謝謝版主大人,解決了
那恭喜你了
不過你還要注意檢查一下,每一頁的
是否都一樣