Java tutorial
//package com.java2s; import java.net.*; public class Main { public static String spec(String host, String botid, String custid, String input) { //System.out.println("--> custid = "+custid); String spec = ""; try { if (custid.equals("0")) // get custid on first transaction with Pandorabots spec = String.format("%s?botid=%s&input=%s", "http://" + host + "/pandora/talk-xml", botid, URLEncoder.encode(input, "UTF-8")); else spec = // re-use custid on each subsequent interaction String.format("%s?botid=%s&custid=%s&input=%s", "http://" + host + "/pandora/talk-xml", botid, custid, URLEncoder.encode(input, "UTF-8")); } catch (Exception ex) { ex.printStackTrace(); } System.out.println(spec); return spec; } }