Phpcurl spoofing referer and source IP instance

Source: Internet
Author: User
Phpcurl spoofing referer and source IP addresses are very simple. today we have done a collection of images. below I will sort out two examples for your reference. example 1, the code is as follows :? Php $ post_dat... php curl forgery referer and source IP address is very simple. today we have done a collection of images. below I will sort out both examples for your reference.

Example 1,The code is as follows:

 "Gongwen", "pwd" => "123456"); $ header_ip = array ('client-IP: 88.88.88.88 ', 'X-FORWARDED-FOR: 88.88.88.88 ',); $ referer = 'http: // www.phprm.com '; $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, 'http: // localhost/curl/two. PHP '); // counterfeit source referer curl_setopt ($ ch, CURLOPT_REFERER, $ referer); // counterfeit source ip curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ header_ip ); // submit the post parameter curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post_data); // add this parameter to execute curl_exec and use the output as the return value. it is not output to the browser curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); $ out_put = curl_exec ($ ch); curl_close ($ ch); echo $ out_put;

Two. php

 '; Echo $ _ SERVER ['http _ referer']; // request source ip address // [note] the IP address printing sequence here is the IP address acquisition sequence of many open source systems. echo '[IP]
'; Echo $ _ SERVER ['http _ CLIENT_IP']; echo'
'; Echo $ _ SERVER ['http _ X_FORWARDED_FOR']; echo'
'; Echo $ _ SERVER ['remote _ ADDR']; // POST data echo '[POST]
';  var_dump($_POST);  echo '
';

Example 2The code is as follows:

function getImagesUrl( $url,$userinfo,$header) {     $ch = curl_init();     $timeout = 1;     curl_setopt ($ch, CURLOPT_URL, "$url");     curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);     curl_setopt ($ch, CURLOPT_REFERER, "http://www.phprm.com/");      curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);     curl_setopt ($ch, CURLOPT_USERAGENT, "$userinfo");     curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);          $contents = curl_exec($ch);     curl_close($ch);     //echo $contents;     return $contents ;      }  function saveurl( $handle ,$filename) {     $fp = fopen($filename,"w");     fwrite($fp,$handle);     unset($fp);     unset($handle); }  $binfo =array('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; InfoPath.2; AskTbPTV/5.17.0.25589; Alexa Toolbar)','Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0','Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; Alexa Toolbar)','Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.1; SV1)',$_SERVER['HTTP_USER_AGENT']); //123.125.68.* //125.90.88.*  $cip = '123.125.68.'.mt_rand(0,254); $xip = '125.90.88.'.mt_rand(0,254); $header = array(  'CLIENT-IP:'.$cip,  'X-FORWARDED-FOR:'.$xip,  );  $u = $binfo[mt_rand(0,3)];  $get_file = getImagesUrl($value,$u,$header); saveurl($get_file,'a.jpg');

You can.


Tutorial address:

Reprinted! But please include the article address ^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.