Trying to POST form data to an external url

  • yonatron
    Asked on May 19, 2017 at 9:50 AM

    Hi - did you recently change the format of the POST body?

    This used to work differently (Fall of 2016), and now it looks like everything's coming in just like query parameters (inside the POST body!).

    For example I got this as a POST body:

    "submission_id=3710108197598787371&formID=62568855409166&ip=xxx.xx.xx.xx&chooseusername=Goofy5&name%5B%5D=Goofy+&name%5B%5D=Goofus&address%5B%5D=123+main+ave&address%5B%5D=&address%5B%5D=anytown&address%5B%5D=New+Jersey&address%5B%5D=07055&address%5B%5D=United+States&email=jadegreen%40gmail.com&linkedin=Jade+Green"

    Is this what you intended or did I do something wrong?

    I can work with this, but will have to URL decode, change my parsing etc.

    If so, that's fine, but can you assure me that you are (hopefully) going to keep the format this way? (Please!)

    Thanks,

    Jade Green

     

  • Nik_C
    Replied on May 19, 2017 at 11:47 AM

    Not sure if format changed, we didn't have such reports recently. I tested the show post data option and this is the response I got and format of the post data:

    Trying to POST form data to an external url Image 1 Screenshot 20

    Could you please show us response from your form, here is the URL that you should place in your Thank you page: https://www.jotform.com/show-post-data/

    We will wait for your response.

    Thank you!

  • yonatron
    Replied on May 19, 2017 at 12:49 PM

    Do you have any option to POST as JSON?

    Here's what came in from your show-post-data page.

    However this is NOT the raw POST body it has already been parsed and processed.

    The raw POST data is as I showed above.

     Data Submitted:

    Array ( [submission_id] => 3710214797598100061 [formID] => 62568855409166 [ip] => 173.54.39.57 [chooseusername] => texas [name] => Array ( [0] => tex [1] => texan ) [address] => Array ( [0] => 19 sailor lane [1] => [2] => cheyenne [3] => WY [4] => [5] => United States ) [email] => sailor@wyoming.com )

    PHP Code:
    $_POST['submission_id'];
    $_POST['formID'];
    $_POST['ip'];
    $_POST['chooseusername'];
    $_POST['name']['0'];$_POST['name']['1'];
    $_POST['address']['0'];$_POST['address']['1'];$_POST['address']['2'];$_POST['address']['3'];$_POST['address']['4'];$_POST['address']['5'];
    $_POST['email'];

  • Ashwin JotForm Support
    Replied on May 19, 2017 at 2:15 PM

    Hello yonatron,

    Form's POST data is not as JSON object. The output you see by using the sample URL "show-post-data" seems to be parsed but you are anyway not gong to use this in your live form. You will have to write your own PHP server side code to read the POST data.

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!