6 Replies Latest reply on Mar 10, 2009 5:45 AM by Cherax79

    postNetText

    ooi
      Dear Sir/ Madam

      Please guide me for below script.

      on mouseUp me

      myurl="www.its-solution.com/sample.txt" --// this is the file that i want to place text name mytext

      mytext=["ooi"]
      netID = postNetText(myurl,mytext)

      put netError(netID)
      put netTextResult(netID)

      if netDone(netID) then
      member("text").text = netTextResult(netID)
      end if


      end

      unfortunately the netError is "1" and refer to the possible error codes means Occurs when the local path points to a directory which doesn't exist

      Any idea. Thanks Thanks
        • 1. Re: postNetText
          Level 7
          There are a few things wrong here. One is that you are using
          postNetText when getNetText would be more appropriate. You are not
          posting anything....

          Next, is that you should preface your web address with "http:\\"

          Third is that the net operation is asynchronous. It will not retrieve
          the text immediately, so when you have the "if netDone (netID) then"
          line, it will ALWAYS evaluate to false. It will never be done by the
          time you are doing it. You should put that bit into a different handler
          that is constantly being monitored.

          Like this:

          --snip--
          property pNetID

          on mouseUp me
          myurl=" http://www.its-solution.com/sample.txt"

          pNetID = getNetText(myurl)

          put netError(pNetID)
          put netTextResult(pNetID)

          end

          on enterFrame me
          if netDone(pNetID) then
          member("text").text = netTextResult(pNetID)
          end if
          end
          --snip--
          • 2. Re: postNetText
            ooi Level 1
            Thanks for your comment.

            my intention is to over write the TEXT in the file name " http://www.its-solution.com/sample.txt". postNetText.

            I have no problem to retrieve the TEXT in " http://www.its-solution.com/sample.txt" by using getNetText.

            also mean i want to post the string text "abc12345" into the file " http://www.its-solution.com/sample.txt". But my postNetText not working. Please advice. Thanks

            • 3. Re: postNetText
              Level 7
              You would typically use a server side script to do this. You can not
              change the contents of a file on the web with postNetText. That is not
              what it does. If you had, for example, a php script that you could post
              to and it would take that input and put it into a database or something,
              then you would use postNetText. Can you imagine the chaos if anyone
              could post anything they want to any text file on the internet? Bear in
              mind that HTML files are really just text with markup. I would be able
              to change any HTML page I want to whatever I want. Obviously that would
              be bad news, and thus you can not do what you are asking for. There are
              other xtras that let you upload files to a server that you have write
              access to, for example DirectFTP can log into an FTP site and upload a
              file. So if your website has FTP access (and most do), then you can use
              it to set the text file.
              • 4. Re: postNetText
                ooi Level 1
                Thanks Thanks. Im clear now. Actually i just place an order to puchased the DirectFTP for that function. I thing the problem can be solved. Anyway thanks for your technical comment. Thanks
                • 5. Re: postNetText
                  Level 7
                  > Actually i just place an order to puchased the DirectFTP for that function.

                  If you want an xtra that can manage FTP access, I would rather recommend
                  ShockFiler - much better support and on-going development.
                  • 6. Re: postNetText
                    Cherax79 Level 1
                    quote:

                    Originally posted by: ooi
                    Thanks for your comment.

                    my intention is to over write the TEXT in the file name " http://www.its-solution.com/sample.txt". postNetText.

                    I have no problem to retrieve the TEXT in " http://www.its-solution.com/sample.txt" by using getNetText.

                    also mean i want to post the string text "abc12345" into the file " http://www.its-solution.com/sample.txt". But my postNetText not working. Please advice. Thanks




                    I see where is the problem.
                    You do not understand getNetText and postNetText methods.
                    getNetText means "execute" php or other script using method GET
                    postNetText means the same but using method POST
                    get doesn't mean "read" and
                    post doesn't mean "send".

                    If You want to write some data to file on external server you should use php script which will handle the file.