CURL With Spoof ip address


December 2018


9.2k time


I heard from some friend 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 :


$ip = '';
$url = "";
$options = array (
    CURLOPT_CONNECTTIMEOUT => 1, // timeout on connect
    CURLOPT_TIMEOUT => 1, // timeout on response
    CURLOPT_URL => $url ,
$ch = curl_init();
curl_setopt_array ( $ch, $options );
$result = curl_exec($ch);


one to get and save data :

    $file = 'ip.txt';
    $ipaddress = $_SERVER["REMOTE_ADDR"] .'\n';
    file_put_contents($file, $ipaddress, FILE_APPEND );

and one to see the ip addresses as you can see 'ip.txt'.

But the problem is all i get in ip.txt is '' and no spoof ip !!

If this is not working at all , What is the solution ?

Update :

I find out this :

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!

Then how can i test a webpage with different IP address ?

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.

0 answers