PHP Curl fake IP Source instance code _php tutorial

Source: Internet
Author: User
Curl makes the requested file fake_ip.php:
Code
Copy CodeThe code is as follows:
$ch = Curl_init ();
$url = "http://localhost/target_ip.php";
$header = Array (
' client-ip:58.68.44.61 ',
' x-forwarded-for:58.68.44.61 ',
);
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_httpheader, $header);
curl_setopt ($ch, curlopt_returntransfer,true);
$page _content = curl_exec ($ch);
Curl_close ($ch);
echo $page _content;
?>

The requested target file target_ip.php:
Copy CodeThe code is as follows:
echo getenv (' http_client_ip ');
echo getenv (' http_x_forwarded_for ');
echo getenv (' remote_addr ');
?>

The IP print order in the target file target_ip is the IP acquisition order of many open source systems at present.
Visit fake_ip.php and see the results:
58.68.44.61
58.68.44.61
127.0.0.1
Instance
Curl is really tough and can forge IP and source.
1.php request 2.php.

1.php Code:

Copy CodeThe code is as follows:
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, "http://localhost/2.php");
curl_setopt ($ch, Curlopt_httpheader, Array (' x-forwarded-for:8.8.8.8 ', ' client-ip:8.8.8.8 ')); Constructing IP
curl_setopt ($ch, Curlopt_referer, "http://www.jb51.net/"); Construction route
curl_setopt ($ch, Curlopt_header, 1);
$out = curl_exec ($ch);
Curl_close ($ch);


The 2.php code is as follows:

Copy CodeThe code is as follows:
function Getclientip () {
if (!empty ($_server["Http_client_ip"))
$ip = $_server["Http_client_ip"];
else if (!empty ($_server["http_x_forwarded_for"]))
$ip = $_server["Http_x_forwarded_for"];
else if (!empty ($_server["REMOTE_ADDR"]))
$ip = $_server["REMOTE_ADDR"];
Else
$ip = "Err";
return $IP;
}
echo "IP:". Getclientip (). "";
echo "Referer:". $_server["Http_referer"];

Forgery success, this is not to "brush ticket" friends provide a good solution for IP

http://www.bkjia.com/PHPjc/326165.html www.bkjia.com true http://www.bkjia.com/PHPjc/326165.html techarticle Curl makes the requested file fake_ip.php: Code copy Code is as follows:? php $ch = Curl_init (); $url = "http://localhost/target_ip.php"; $header = array (' client-ip:58.68.44.61 ', ' ...

  • Related Article

    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.