title: CURL With Spoof ip address
body: <p>I heard from some <a href="https://stackoverflow.com/questions/5188584/how-can-i-spoof-the-sender-ip-address-using-curl">friend</a> that we can spoof our ip address in Curl with HTTP_X_FORWARDED_FOR , so i decide to test it and i create three file one to send Curl :</p>
  
  <pre><code>&lt;?php
  
  $ip = '1.1.1.1';
  $url = "http://127.0.0.1/mydir/getdata.php";
  $options = array (
      CURLOPT_CONNECTTIMEOUT =&gt; 1, // timeout on connect
      CURLOPT_TIMEOUT =&gt; 1, // timeout on response
      CURLOPT_MAXREDIRS =&gt; 1 ,
      CURLOPT_HTTPHEADER =&gt; array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"),
      CURLOPT_URL =&gt; $url ,
      );
  $ch = curl_init();
  curl_setopt_array ( $ch, $options );
  print_r("+");
  $result = curl_exec($ch);
  curl_close($ch);
  
  ?&gt;
  </code></pre>
  
  <p>one to get and save data :</p>
  
  <pre><code>&lt;?php
      $file = 'ip.txt';
      $ipaddress = $_SERVER["REMOTE_ADDR"] .'\n';
      file_put_contents($file, $ipaddress, FILE_APPEND );
  ?&gt;
  </code></pre>
  
  <p>and one to see the ip addresses as you can see 'ip.txt'.</p>
  
  <p>But the problem is all i get in ip.txt is '127.0.0.1' and no spoof ip !!</p>
  
  <p>If this is not working at all , What is the solution ?</p>
  
  <p><strong>Update</strong> :</p>
  
  <p>I find out this :</p>
  
  <blockquote>
    <p>No. libcurl operates on a higher level than so. Besides, faking IP
    address would imply sending IP packages with a made-up source address,
    and then you normally get a problem with intercepting the packages
    sent back as they would then not be routed to you!</p>
  </blockquote>
  
  <p>Then how can i test a webpage with different IP address ?</p>
  
  <p>I have some experience with programming language python , it can send a packet with spoof ip address but the problem is , it cant fully create TCP three way hand shaking process and the main website understand it.</p>