-
- #!/bin/awk -f
-
- #运行前
- BEGIN {
- FS = " ";
- count = 0;
- }
-
- #运行中
- {
- iparr[count ++] = $0;
- }
-
- #运行后
- END {
- printf(" printf("$iparr = array(n");
- for (i = 0; i < count; i ++) {
- printf("'%s' => '%s',n", iparr[i], iparr[i]);
- }
- printf(");n");
- }
复制代码
二,CURL使用
-
- /**
- * CURL fake IP address access
- * by bbs.it-home.org
- */
- require_once dirname(__FILE__) . "/iplib.php";
-
- $req_url = "test.com";
-
- foreach ($iparr as $forward => $cip) {
-
- $ch = curl_init();
-
- curl_setopt($ch, CURLOPT_URL, $req_url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "X-FORWARDED-FOR:$forward",
- "CLIENT-IP:$cip"
- ));
- curl_setopt($ch, CURLOPT_REFERER, 'http://blog.csdn.net/');
- curl_setopt($ch, CURLOPT_HEADER, 1);
-
- curl_exec($ch);
-
- curl_close($ch);
- }
复制代码
不足:
很多服务器端一般都采用了$_SERVER['REMOTE_ADDR']来获取客户端的真实ip,这是在传输层就已经决定的地址,无法通过CURL进行修改。
这点记录下,有好的办法再分享。
|