×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    179

    Lightbulb some time it works some times it not ?

    try {
    String message = "name1=she+he%21";
    //String url = getAppProperty("PostMIDlet-URL");
    String url = "http://schoolsmart.in/mdm/abc.php";
    hc = (HttpConnection)Connector.open(url);
    hc.setRequestMethod(HttpConnection.POST);
    hc.setRequestProperty("Content-Type",
    "application/x-www-form-urlencoded");
    hc.setRequestProperty("Content-Length",
    Integer.toString(message.length()));
    out = hc.openOutputStream();
    out.write(message.getBytes());
    in = hc.openInputStream();
    int length = (int)hc.getLength();
    byte[] data = new byte[length];
    in.read(data);
    String response = new String(data);
    StringItem stringItem = new StringItem(null, response);
    mForm.append(stringItem);
    mForm.setTitle("Done.");
    }
    i am not that expert in j2me , i am trying to learn it .. in the above code i am trying to hit a url "http://schoolsmart.in/mdm/abc.php" with a massage "String message = "name1=she+he%21";" and then read the content back , some times it work some time it doesn't if any one has any clue....

  2. #2
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: some time it works some times it not ?

    Quote Originally Posted by Arunesh View Post
    try {
    String message = "name1=she+he%21";
    //String url = getAppProperty("PostMIDlet-URL");
    String url = "http://schoolsmart.in/mdm/abc.php";
    hc = (HttpConnection)Connector.open(url);
    hc.setRequestMethod(HttpConnection.POST);
    hc.setRequestProperty("Content-Type",
    "application/x-www-form-urlencoded");
    hc.setRequestProperty("Content-Length",
    Integer.toString(message.length()));
    out = hc.openOutputStream();
    out.write(message.getBytes());
    in = hc.openInputStream();
    int length = (int)hc.getLength();
    byte[] data = new byte[length];
    in.read(data);
    String response = new String(data);
    StringItem stringItem = new StringItem(null, response);
    mForm.append(stringItem);
    mForm.setTitle("Done.");
    }
    i am not that expert in j2me , i am trying to learn it .. in the above code i am trying to hit a url "http://schoolsmart.in/mdm/abc.php" with a massage "String message = "name1=she+he%21";" and then read the content back , some times it work some time it doesn't if any one has any clue....
    Means ?
    have u got any exception. try to debug by writing every step to form which is processed. then u will be able to find out that how long ur program is running.
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. get log local time ?
    By ali3635 in forum Symbian
    Replies: 10
    Last Post: 2008-10-21, 04:28
  2. 6670 asks for date time on startup
    By collinar in forum General Development Questions
    Replies: 0
    Last Post: 2005-09-28, 16:03
  3. Bizarre calendar/time zone change handling in Nokia 9500
    By noetus in forum General Development Questions
    Replies: 0
    Last Post: 2005-09-19, 19:27
  4. Replies: 0
    Last Post: 2005-07-27, 11:21
  5. How to get correct time.
    By dzaga in forum Mobile Java General
    Replies: 2
    Last Post: 2003-08-06, 22:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×