PHP uses curl to forge IP and source

Source: Internet
Author: User

I haven't done this before.

A friend of the group is asking this question today.

Check it out, curl is really tough to forge IP and source.

1.php request 2.php.

1.php Code:

$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 '));  Tectonic ipcurl_setopt ($ch, Curlopt_referer, "http://www.gosoa.com.cn/");   Tectonic Route curl_setopt ($ch, Curlopt_header, 1); $out = Curl_exec ($ch); Curl_close ($ch);

The 2.php 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 to provide a very good scheme for IP change!!

Ha ha.

Someone message: You forged in the other side does not have a proxy IP and remote_addr the effect of blocking at the same time.

Excerpt from: http://www.gosoa.com.cn/php%E7%94%A8curl%E4%BC%AA%E9%80%A0ip%E5%92%8C%E6%9D%A5%E6%BA%90

PHP uses curl to forge IP and source

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.