使用 PHP CURL 到 post 表单数据时使用客户端 IP 地址

USING client ip address while using PHP CURL to post form data

我正在尝试使用 curl 将 post 数据发送到表单并且一切正常,除了当我发送表单时,它在发送表单时使用服务器 ip 地址,但我真正想做的是设置一个自定义用户代理(我需要使用curl的原因)并且我需要客户端的ip保持不变。

这是我现在使用的代码。

//open connection
$ch = curl_init();

//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);

//The next line set the user agent to a custom one.

curl_setopt($ch, CURLOPT_USERAGENT, "Mobile UA :" . $rrand );
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);

我希望 curl 在发送表单时使用客户端 IP 地址,而不是托管 php 脚本的服务器地址。如果可以将自定义服务器地址设置为 post 表单,那也会有所帮助。

如果您能够伪造请求,让它看起来像是来自用户的网络,那么响应也会进入用户的网络,那里不会有任何等待它的地方。

所以不,这是不可能的。