douzhechi2435 2013-08-02 20:01
浏览 102
已采纳

JAVA访问php文件 - 类似于HTTP_REFERER?

I'm on apache server and use a PHP HTTP_REFERER just to check that a few clients are accessing from pre-determined URLS. I have someone inquiring about accessing from a JAVA application. I know nothing about JAVA and I'm trying to find an alternative way to recognize the referring location accessing my php files. (I've also used an .htaccess with HTTP_REFERER in the past but again not for JAVA trying to gain access).

This doesn't need to be a complex "fort knox" solution because I know HTTP_REFERER isn't that in the first place, I just don't want the link being passed around freely in the wild.

?

  • 写回答

2条回答 默认 最新

  • dongshan1811 2013-08-02 20:16
    关注

    The question depends on what HTTP library your client is using to access your stuff from Java. A decent HTTP client library (e.g. Apache HTTPClient) will let you set arbitrary headers. See for example http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。
  • ¥20 CST怎么把天线放在座椅环境中并仿真