×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    8

    http post is not working on 3650

    Hello,

    I try to send some data to a web serveur using the http post method and to get the data with a PHP page. The problem is that when the php script try to read the variable, it's empty.

    The midlet code, is the one that is provide by sun on the address :
    http://wireless.java.sun.com/midp/ar...ostMidlet.java
    And the code of the php page is like follow :
    <?php
    mail("info@lombric.ch",$_POST['name'],$_POST['name']);
    echo "Confirmation";
    ?>
    I¡¯m using a nokia 3650 to make the test.
    I know that the connection is ok and that the script had been executed, because I get the mail, but the variable ¡®name¡¯ is empty !!!
    If someone add an idee why is not working please tell me¡_

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Israel
    Posts
    2,280
    Sometimes the network carrier has things set up so that POST's are cut off. This sounds like what your problem may be.
    Try installing a sniffer on your server to see exactly how the request your sending looks, and I think you'll see that your POST data is not arriving, and maybe some of your headers have been mangled with.
    The solution for this is usually to use an Internet access point instead of a WAP access point (by setting the gateway IP to 0.0.0.0 in the connection settings of the phone).

    shmoove

  3. #3
    Registered User
    Join Date
    Mar 2003
    Location
    Croatia
    Posts
    27

    HTTP POST seems to be common pitfall for developers these days.

    I had same the same problem. Just look at thread: http://discussion.forum.nokia.com/fo...threadid=33254

    What shmoove told you is probably write about carriers cutting POST's. But it shouldn't happen to local machine on local server using the emulator.

    I hope there is sollution in PHP for fetching POST data. I couldn't find it. And I've searched it for days.

    PHP works fine when classic web clinets are POSTing data. Maybe we should give fake info for user agent.

    However, PERL and ASP fetch posted data pretty well.

    You may try them as an alternative.

    Greetings,
    Ivan

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    37

    maybe due to tcpip chunking...

    we had similar problems in a Java servlet on tomcat 4.1, where seemingly the parameters were being stripped out of the request. however, in that case, we noticed that there was some body content - lo and behold, the parameters were actually in the message body, but had not been parsed by tomcat to be presented through the servlet interface. so i think actually this was a tomcat problem but perhaps common to other servers?

    so the solution would be to not rely on your server to extract the parameters, but try and pick up what it regards to be the message body which would look something like:

    action=email&subject=j2me_network_access&message=all_screwed_up&recipients=operators

    which you can now parse to breakdown into parameter & value pairs. hopefully!

    after this we helped another developer fix the same problem with a SE t610 -> tomcat. on closer investigation (using Ethereal), the chunking of the request was different to other phones - the request was coming in 3 chunks (it was something like (1) HTTP POST line (2) headers and (3) parameters) whereas other phones were posting 2 chunks.

    this might help explain why you can see this behaviour through one network's gateways and different behaviour on other networks - it is down to the gateways (and their configurations) as to whether they keep the same chunking or run them together in a buffer before forwarding? or whatever other grim messing around as shmoove says...

    btw, for direct internet there may be more settings to change than just gateway IP, but usually problems i've had with WAP APN vs Internet APN is whether the request gets through at all.

    good luck,
    dan.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    8

    Still not working with php...

    First Thank all of you for the answers...

    I have been trying many things to make working php and midlet post, but without any result.
    At the end I'm using a servlet, that can fetch the information that I need.
    If someone, find something new for php, please tell-it but at least you know that with a servlet, all is working fine

Posting Permissions

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