Sending leads from a site powered by Java

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

For Example:

function DoPOST()
    URL url = new URL("");

    String document = "<Leads vid='1234' lid='1234' aid='1234'>
                     <Lead reference='ABC1234'>

    FileReader fr = new FileReader(document);

    char[] buffer = new char[1024*10];
    int b_read = 0;

    if ((b_read = != -1)
        URLConnection urlc = url.openConnection();

        PrintWriter pw = new PrintWriter(urlc.getOutputStream());
        pw.write(buffer, 0, b_read);

        BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream()));

        String inputLine;

        while ((res_line = in.readLine()) != null)

In the example above, the example POST XML is first generated 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