Sending leads from a site powered by Java

To send leads in from a lead form's backend code, you would generate a POST string and write that string to the desired POST URL.

For Example:

function DoPOST()
    String data = URLEncoder.encode("FirstName", "UTF-8") + "=" + URLEncoder.encode("John", "UTF-8");
    data += "&" + URLEncoder.encode("LastName", "UTF-8") + "=" + URLEncoder.encode("Doe", "UTF-8");
    data += "&" + URLEncoder.encode("Email", "UTF-8") + "=" + URLEncoder.encode("", "UTF-8");
    URL url = new URL("");
    URLConnection conn = url.openConnection();
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
            // Process line...
In the example above, the example POST string is first encoded and then is sent through the request stream to the POST URL. The response is then received and would then be processed to determined the desired action depending on the sending page's requirements and method sent to.

Copyright ©2012