Announcement

Collapse
No announcement yet.

Access raw POSTED data

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Access raw POSTED data

    I have some mivascript that receives raw data from an http post, not in name=value pairs. Is there a way to access it?
    Susan Petracco
    NetBlazon

    1.866.400.2444

    _____________________________________________

    Like us on Facebook

    #2
    If I am understanding right - shouldn't
    Code:
    <MvAssign name="stuff" value="{ arg2 }">
    work?
    Then write it to a file... or send an email, or....
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    Comment


      #3
      arg2 is empty.

      But maybe the issue is on the sending script. I'll write something to post to it so I control the postER, and then I can see what the postEE does. Thanks Bill.

      Susan Petracco
      NetBlazon

      1.866.400.2444

      _____________________________________________

      Like us on Facebook

      Comment


        #4
        Try just arg
        William Gilligan - Orange Marmalade, Inc.
        www.OrangeMarmaladeinc.com

        Comment


          #5
          I handled this for a project some years ago. I don't recall the details, but I think there's a Linux environment variable that contains the data you need; and there's a way to configure Miva to pass that environment variable to you as a system variable. Hope that helps --
          Kent Multer
          Magic Metal Productions
          http://TheMagicM.com
          * Web developer/designer
          * E-commerce and Miva
          * Author, The Official Miva Web Scripting Book -- available on-line:
          http://www.amazon.com/exec/obidos/IS...icmetalproducA

          Comment


            #6
            If it is json, this is what I use... (Kent triggered a memory)
            Code:
            <MvAssign name="l.ok" value="{ miva_json_decode(s.content_data, respOut) }">
            William Gilligan - Orange Marmalade, Inc.
            www.OrangeMarmaladeinc.com

            Comment


              #7
              Then something like this to deal with it
              Code:
                 <MvAssign name="cust" value="{ respOut:data:object:customer }">
                 <MvAssign name="var1" value="{ respOut:data:object:lines:data[1]:id }">
              William Gilligan - Orange Marmalade, Inc.
              www.OrangeMarmaladeinc.com

              Comment


                #8
                Kent and BIll, you two RULE. s.content_data is exactly where the information was landing. Thank you both!
                Susan Petracco
                NetBlazon

                1.866.400.2444

                _____________________________________________

                Like us on Facebook

                Comment


                  #9
                  I have to give thanks to Brennan for this one...
                  https://www.miva.com/forums/forum/designers-and-developers/mivascript-miva-merchant-empresa/115882-request-body-webhook

                  There is a little more info on the requirements at the above link.
                  William Gilligan - Orange Marmalade, Inc.
                  www.OrangeMarmaladeinc.com

                  Comment


                    #10
                    Did you check s.QUERY_STRING?

                    As for s.content_data Brennan referred to:

                    Is this something that has to be configured in Empresa?
                    Under what conditions is this variable populated?

                    I was planning up updating this page soon. http://www.mivascript.com/topic/system-variables.html and it would be good to know.
                    Last edited by RayYates; 02-20-18, 09:34 AM.
                    Ray Yates
                    "If I have seen further, it is by standing on the shoulders of giants."
                    --- Sir Isaac Newton

                    Comment


                      #11
                      This is something I didn't know and it's going to fix a mess I've been trying to work out for a bit, thanks for this discussion guys!
                      M.A.D.* since 1997

                      http://www.scotsscripts.com

                      *miva application developers

                      Comment


                        #12
                        Ray - according to Brennan,
                        In version 5.18 or higher of Empresa there is a variable that may contain the request body. It is named s.content_data
                        The reason I say "may" is because this is only set if the Content-Type is not "application/x-www-form-urlencoded" or "multipart/form-data"
                        I did not think of the query_string, but it also looks like its only for get and not post?

                        Reach out to Brennan for more info - there may even be more you can add to your update!
                        William Gilligan - Orange Marmalade, Inc.
                        www.OrangeMarmaladeinc.com

                        Comment

                        Working...
                        X