7 Replies Latest reply on Jul 25, 2017 4:37 AM by CamelCase_data

    Insert from url ftp and curl options problem

    Gingernut

      As an intro I can do filemaker but this ftp is all new to me - (as was XSLT but I cracked that over the weekend)

       

      Using Windows and Filemaker 16.

       

      I am trying to add a file (Purchase order xml) to a suppliers ftp server. I keep getting Authentification failed Error 1627 but the details are definitely correct. I have copied and pasted them from ftp programme which does connect.

       

      I have placed my xml file in the container field ( should this be encoded text if it is an XML file - seen that mentioned on another post.

       

      This is my script -

       

      Set Error Capture [On]

      Set Variable [$$result;Value “”]

      Set Variable [$usr; Value:”username” ]   NB the Username has spaces in it – Could this cause a problem?  It is in the format xxxxx - xx

      Set Variable [$pw; Value:”password” ]

      Set Variable [$file; Value: Interface:container]  NB I have put the file in the container NOT with a stored reference - is that bit correct - I have tried both

      Insert from URl [Select; With Dialogue;Off; $$result;

      ftp://weborders.parsia.co.uk/Input/
      & GetContainerAttribute (interface:container:;
      “filename");

      cURL options;”—user “ & $usr & “:” & $pw & “
      –T $file”

       

       

      As well as -T I have tried and --upload-file.

       

      The only thing I can think is causing a problem is the spaces in the Username but don't have to do anything different if I try ftp from the Windows command  prompt -(just type with the spaces.)

       

      It does get as far as showing "URL data transfer transferring file " which makes me even more confused.

       

      Please help as I have spent 2 days trying and reading everything I could. oettelshoven kindly gave me pointers as above but still not getting through.

        • 1. Re: Insert from url ftp and curl options problem
          oettelshoven

          Unfortunately I am not the right man to answer specific ftp questions. All this is also completely new to me, and I struggled for two weeks ;-) until bigtom gave me the missing hints.

           

          I can't see what's wrong with your code, neither do I know if the space in the username could spoil the broth. But why don't you just try it out with another username? I always start with the minimum parameters in order to keep out all these questions.

           

          There is only one thing I would change in your code just to be sure:

          Instead of

          ftp://weborders.parsia.co.uk/Input/& GetContainerAttribute (interface:container:; “filename");

          put all this into another variable $host or so. In this way you can check if the given path is correct. Sometimes there is only a dot or a slash missing.

           

          Some of my attempts also ended in error 1627, but these all were based on syntax or parameter mistakes.

           

          Don't waste your time with --upload-file. This is quite another thing.

           

          Good luck!

          • 2. Re: Insert from url ftp and curl options problem
            beverly

            How did you put the file into the container? Did you use the new:

            TextEncode()

            ?

            Yes! the encoding is important.

            Beverly

            • 3. Re: Insert from url ftp and curl options problem
              Gingernut

              I have looked at this and do not understand it at all  -

              I am finding Filemaker Help so limited in its help it as assumes too much knowledge.

               

              Set Field [ table::container ; TextEncode ( table::text ; "iso-8859-1" ; 4 )

              Export Field Contents [ table::container ; "output.txt" ]

               

              I do not want a text file I want to send the XML file that is in my container file. So do I need this and if so where do I apply it. -there are no options when I put the file into the container and if I add a script step it changes the name and contents of the file.

               

              I need more than Filemaker help I need an idiots guide

               

              Is there an easier way to upload a file maybe using a command line????? I feel like I am one step forward and two steps back as it took me days to get my XSLT to work to create the XML file that I needed but now I cannot upload it. Thanks Beverly for the XSLT help I did get there in the end with that. 

              • 4. Re: Insert from url ftp and curl options problem
                beverly

                iso-8859-1

                ?

                What encoding is on your XML? It likely is UTF-8 and you should be setting that encoding in the TextEncode().

                 

                See these threads on cURL and FTP:

                 

                cURL is new to many in the FileMaker community. I'm waiting for DevCon to be over and many postings on what was discussed there about cURL. Perhaps we'll see more articles after that?

                Beverly

                • 5. Re: Insert from url ftp and curl options problem
                  Jens Teich

                  Try to enclose the username in additional double quotes, which have to be escaped in FM with backslash:

                   

                  set variable[ $user; "\"username with spaces\""]

                  2 of 2 people found this helpful
                  • 6. Re: Insert from url ftp and curl options problem
                    Gingernut

                    I seem to have made a connection as Pause on Error did not kick me out BUT I now have this in my $$result and I have no idea what it means - any clues - I am guessing it is to do with http verb used to access this page but how do I overcome this please

                     

                     

                     

                     

                    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

                     

                    <html xmlns="http://www.w3.org/1999/xhtml">

                     

                    <head>

                     

                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

                     

                    <title>405 - HTTP verb used to access this page is not allowed.</title>

                     

                    <style type="text/css">

                     

                    <!--

                     

                    body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}

                     

                    fieldset{padding:0 15px 10px 15px;}

                     

                    h1{font-size:2.4em;margin:0;color:#FFF;}

                     

                    h2{font-size:1.7em;margin:0;color:#CC0000;}

                     

                    h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;}

                     

                    #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF;

                     

                    background-color:#555555;}

                     

                    #content{margin:0 0 0 2%;position:relative;}

                     

                    .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}

                     

                    -->

                     

                    </style>

                     

                    </head>

                     

                    <body>

                     

                    <div id="header"><h1>Server Error</h1></div>

                     

                    <div id="content">

                     

                    <div class="content-container"><fieldset>

                     

                      <h2>405 - HTTP verb used to access this page is not allowed.</h2>

                     

                      <h3>The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.</h3>

                     

                    </fieldset></div>

                     

                    </div>

                     

                    </body>

                     

                    </html>

                    • 7. Re: Insert from url ftp and curl options problem
                      CamelCase_data

                      LuminFire have published a sample file for cURL, including an FTP example, that probably can be helpful: https://luminfire.com/2017/06/12/curling-filemaker-16/

                      As you'll see in that file, there are a couple of other cURL options you may need to include.

                       

                      You can change the FTP server and login details in the sample file, as well as the Content-type, and then normally everything should work fine.

                      2 of 2 people found this helpful