且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

卷曲IP地址

更新时间:2023-02-24 16:10:18

好的,所以没有办法安全地欺骗 curl 请求的 ip 地址,但我发现了一个不安全的方法,这取决于接收的服务器脚本请求,但它对我来说欺骗了我向其发出请求的 API:

Ok, so there's no way to safely spoof the ip address of a curl request, but I found a non-safe way, it depends on the server script receiving the request, but it worked for me to trick the API I was making the request to:

curl_setopt( $ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));

这并不总是有效,但在这种情况下它对我有用.

This won't always work, but in this case it worked for me.

感谢大家的帮助!