×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    7

    need s60(3650) "http post method" working code

    Hi
    I searched the web and I spent a lot of time to solve this ,but I can't find any solution. My phone is 3650 version 2,50 ...
    Thanks.......

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    6
    Hi You wanted to post some data isn't it..

    you can do something like this

    try{

    HttpConnection hConn = (HttpConnection) Connector.open(url);

    //set the connection to be closed once the transaction is complete
    hConn.setRequestProperty("Connection","close");

    //Get input stream
    InputStream is = hConn.openInputStream();

    int ch = 0;
    while(ch != -1)
    {
    ch = is.read();
    }

    //Output
    OuputStream os = hConn.openOutputStream();
    byte[] data = String("HI").getBytes();
    os.write(data,0,data.length);

    //close alll streams
    is.close();
    os.close();
    hConn.close();

    }
    catch(Exception e)
    {
    System.out.println("Handle this exception");
    }

    I hope u wanted some thing like this..

  3. #3
    Registered User
    Join Date
    Nov 2003
    Posts
    7
    Very very thanks for your reply abhiauradkar,
    I tried it but i can't do it again .Iwill give much information;

    My midlet works on other phone .It dosn't run on real 3650 and s60 emulator.In this forum many people has a problem like this,some of them found a solution.I tried a lot of different combinations to post some data to a java server page but i couldn't.

    I want to post some data like this;

    name=ahmet&surname=hasan&age=50

    Cumhur

  4. #4
    Registered User
    Join Date
    May 2003
    Posts
    14
    Just add it to the end of the url string and open up the browser. That will post the data.

  5. #5
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    134
    Just add it to the end of the url string and open up the browser. That will post the data.
    No, it does a http1.0 GET.

    @cumhur: so why do you need the POST anyway? You'll only need it if you want to transfer more than 1KB to your server... Perhaps a GET will do for you as well indeed?

  6. #6
    Registered User
    Join Date
    Nov 2003
    Posts
    7
    I don't want to use my server ,I want to use it like a mini web browser.maybe one program for one site .and then another program for another web site.

    When I add it to the end of the url string ; and I add this line :
    c.setRequestMethod(HttpConnection.POST);

    It works BUT again only normal phones not in s60 emulator.

    What is the s60's problem?? Why it dosn't %100 compatible with j2me??

    And I need example code of http post (fully,from the begining) which can run on s60.
    I need your helps ,Thanks..

Posting Permissions

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