我使用URLConnection
连接到网站。我使用System.getProperties()
设置proxyHost
和proxyPort
,以及connection.setRequestProperty
来更改用户代理。我还没有找到改变X-Forwarded-For的方法。
有人可以启发我吗?
谢谢!
答案 0 :(得分:3)
尝试以下方法:
connection.addRequestProperty("X-Forwarded-For",VALUE-IP);
参考: http://docs.oracle.com/javase/1.5.0/docs/api/java/net/URLConnection.html#addRequestProperty(java.lang.String,java.lang.String)