import HTTPClient.*; import java.io.IOException; import java.io.InputStream; public class SendPage { /** * This does the work of sending a message to an airtouch pager */ public static boolean send_msg_to_pager(String areacode, String number, String message) { InputStream stream; NVPair form_data[] = new NVPair[3]; form_data[0] = new NVPair("AREACODE", areacode); form_data[1] = new NVPair("NUMBER", number); form_data[2] = new NVPair("MESSAGE", message); /* try to create a connection to airtouch and post the data */ try { HTTPConnection con = new HTTPConnection("iserve.bigweb.com"); HTTPResponse rsp = con.Post("/mall/airtouch/genmail.cgi", form_data); /* did it work ok?*/ if (rsp.getStatusCode() >= 300) { System.err.println("Received Error: "+rsp.getReasonLine()); System.err.println(new String(rsp.getData(),0)); return false; } /* appeared to be ok */ else { stream = rsp.getInputStream(); System.out.println("Sent the data and appeared to work..."); return true; } } catch (IOException ioe) { System.err.println(ioe.toString()); } catch (AuthTypeNotImplementedException atnie) { System.err.println("Can't handle the authorization scheme " + atnie.getMessage()); } return false; } }