CURL 伪造IP 访问网站

发布时间:2019-01-30 14:59:23 作者:zys 阅读量:388142

抓取其它网站数据


简单一点的可以在header伪造X-FORWARDED-FOR,并伪造referer 


 /*随机生成IP*/

         $ip_long = array(


            array('607649792', '608174079'), //36.56.0.0-36.63.255.255


            array('1038614528', '1039007743'), //61.232.0.0-61.237.255.255


            array('1783627776', '1784676351'), //106.80.0.0-106.95.255.255


            array('2035023872', '2035154943'), //121.76.0.0-121.77.255.255


            array('2078801920', '2079064063'), //123.232.0.0-123.235.255.255


        );

         $rand_key = mt_rand(0, 4);

         $ip= long2ip(mt_rand($ip_long[$rand_key][0], $ip_long[$rand_key][1]));

        curl_setopt($cur, CURLOPT_REFERER, "http://www.s303s.com/");

        curl_setopt($cur, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

        curl_setopt($cur, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.$ip, 'CLIENT-IP:'.$ip));

        curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);

        curl_setopt($cur, CURLOPT_HEADER, 0);

        curl_setopt($cur, CURLOPT_TIMEOUT, 60);

        curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($cur, CURLOPT_SSL_VERIFYHOST, false);

        curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);

        $rec = curl_exec($cur);

        curl_close($cur);

        return $rec;


微信打赏

我要评论 登录后才能发布评论

最新图文

Catfish(鲶鱼) CMS   我要留言 网站地图
冀ICP备17018518号-2
Catfish(鲶鱼) CMS V 4.8.66