×

Discussion Board

Page 1 of 5 12345 LastLast
Results 1 to 15 of 67
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:54.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: HTTP POST & PHP ERROR

    try with HTTP GET and if it works , then try without UTF-8 encodoing.

    thanks,
    ~Amitabh

  3. #3
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:54.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: HTTP POST & PHP ERROR

    Hello,

    What is the value that you are getting for the response code and the response message?
    try to remove the UTF-8 from the line
    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
    an then test.
    Also add this line out.flush() after out.write(Data);
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:54.

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: HTTP POST & PHP ERROR

    Hello,
    your code has to be debugged, but at the time I will recommend you to have the look over the demo below and then compare your code and defintely you will find the error in you code.For the time being please folow the code,

    /**
    This function connects to web server and passes the parameter name to the
    target in HTTP POST request. Upon successful connection, web server returns
    birthday for 'name'.
    This function also calls getConnectionInformation to retrieve properties of
    HTTPConnection
    **/

    public void connectServerPostData(String name) throws IOException {

    HttpConnection httpConn = null;
    String url = "your URL";
    InputStream is = null;
    OutputStream os = null;

    try {
    // Open an HTTP Connection object
    httpConn = (HttpConnection)Connector.open(url);
    // Setup HTTP Request to POST
    httpConn.setRequestMethod(HttpConnection.POST);

    httpConn.setRequestProperty("User-Agent",
    "Profile/MIDP-2.0 Confirguration/CLDC-1.0");
    httpConn.setRequestProperty("Accept_Language","en-US");
    //Content-Type is must to pass parameters in POST Request
    httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    os = httpConn.openOutputStream();

    String params;
    params = "Some value";

    os.write(params.getBytes());

    //os.flush();

    } finally {
    if(os != null)
    os.close();
    if(httpConn != null)
    httpConn.close();
    }

    }
    This code works for me. Please check and let us know your luck about this.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:54.

  8. #8
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR *URGENT*

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:55.

  9. #9
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: HTTP POST & PHP ERROR

    Quote Originally Posted by shanklin View Post
    Hi,
    Also in the example you showed me, could you tell me why are you passing the parameter string name, to the method, even though it is not being used at all in that method?

    PHP Code:
     public void connectServerPostData(String namethrows IOException 
    I will be grateful for any input,please help.

    Many Thanks,
    For the bold lines I will say that this I forget to remove from there in the code.Since that method I am using.
    Well did you check that method's execution?
    what are the results?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  10. #10
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: HTTP POST & PHP ERROR

    Set register_globals on in php.ini of your server.

    change $testname = $_POST["name"]; to $testname = $name"; and try.

    thanks,
    ~Amitabh

  11. #11
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:55.

  12. #12
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: HTTP POST & PHP ERROR

    Hello,
    What is error that you are facing right now?
    Was your server called?
    I would suggest one more thing,is that you check this code for the client and server as well. For the time being you check whether the client is able to send the request and in turn the server is sending the response.
    This is already tested code.
    http://www.java2s.com/Code/Java/J2ME...avaservlet.htm

    What you have to do is just give your URL string in place of its own.Please check this and share the results.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: HTTP POST & PHP ERROR

    Try SUN WTK 2.5.2 emulators for MIDP phones if the app works on it then try on S60 Emulator or real device.

    thanks,
    ~Amitabh

  14. #14
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    159

    Exclamation Re: HTTP POST & PHP ERROR

    Hi,

    Thanks
    Last edited by shanklin; 2010-09-21 at 13:55.

  15. #15
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Thumbs up Re: HTTP POST & PHP ERROR

    Hello,

    1.It, asks me if i want to select an access point i.e. Winsock, I press connect.
    2. It then gives me a security warning, saying do you want the application to use the network + send or recieve data?
    3. After saying YES, it asks, me to open a Winsock connection again!
    4. Then all it says on the emulator is:
    Starting MIDlet...
    Please wait....
    Yeah exactly this should follow like this.This is going you know in the correct direction.

    What next is happening?
    You check that whether the server was hit by the request or not?
    try to run the app using the WTK and default emulator, so that you can view the SOP's on the console. Try to put the SOP in the code and try to find out that up to which line the control comes.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. error including vector
    By Lichtens in forum Open C/C++
    Replies: 5
    Last Post: 2009-04-03, 14:19
  2. sending HTTP POST - error 36
    By tomasz.florczak in forum Symbian
    Replies: 4
    Last Post: 2008-03-21, 20:22
  3. error LNK2001: Please Help
    By sourish_khan in forum Symbian
    Replies: 9
    Last Post: 2006-04-19, 11:16
  4. how to avoid linking error
    By skdas in forum Symbian
    Replies: 6
    Last Post: 2003-07-07, 07:57
  5. Replies: 0
    Last Post: 2002-05-09, 12:07

Posting Permissions

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