views:

145

answers:

2

As per title really I'm wanting to send a custom HTTP post request to a web server and I have little experience in this area. The web server uses an LDAP server for access control (not sure if that's important) for which of course I know the username and password. Could anyone flesh out some code to do this or at least get me started?

Edit for one of the comments, the server is running a LAMP stack with PhP 5+ and Apache 2+

A: 

LDAP and authentication are separate issues from sending POSTs to web servers.

Th server side needs to do that authentication. Set it up either in your code or in the web server itself.

If your client is a Java application, you can create a POST using UrlConnection.

If your client is an HTML page or JSP, you need a form with a POST action.

duffymo
+4  A: 

You can use HttpClient module from 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.

Desintegr
Cheers exactly what I was looking for.
dangerstat