根据标题,我真的想发送一个自定义的 HTTP post向网络服务器请求,我在这方面经验很少。 Web 服务器使用 LDAP用于访问控制的服务器(不确定这是否重要),我当然知道用户名和密码。有人可以充实一些代码来做到这一点,或者至少让我开始吗?
编辑其中一条评论,服务器正在运行包含 PhP 5+ 和 Apache 2+ 的 LAMP 堆栈
最佳答案
您可以使用HttpClient来自 Apache 的模块。
Although the java.net package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. HttpClient seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.
Designed for extension while providing robust support for the base HTTP protocol, HttpClient may be of interest to anyone building HTTP-aware client applications such as web browsers, web service clients, or systems that leverage or extend the HTTP protocol for distributed communication.
关于java - 使用 Java 将 HTTP post 发送到 Web 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2305849/