10 Replies Latest reply on Oct 7, 2009 2:10 PM by thaiworthy

    URL not working

    thaiworthy

      I am not having any luck with loading a URL file using the syntax that seems to work OK in browsers.

       

      If I download the file in a browser and save it to my hard drive named "getfeed.dll" it will work. The document is 924 pages long and It takes 6 seconds to parse.

       

      The second reference of pXMLObj.parseURL won't work. It just sits there on the go to frame loop below. I copied this code from an example in another forum, but many example files are old and the links are broken. I do have the XML Xtra documentation that I downloaded from the website, but I am new XML and it is difficult at best.

       

      What are some possible problems with getting files thru a URL path? Why doesn't this work, but the local method can? What am I doing wrong?

       

      In Director, this is what I type as a behavior script: I cannot list the real URL because it contains private company info.

       

      property pXMLObj

      global gMetrofeed

       

      on beginSprite me

        pXMLObj = new (xtra "XMLParser")

       

        pXMLObj.parseURL (the moviePath & "getfeed.dll") THIS WORKS!

       

        --  pXMLObj.parseURL ("username:password@http:www.mycompany.com/getfeed.dll")  THIS DOESN'T WORK!

      end

       

      on endSprite me

        pXMLObj = 0

      end

       

      on exitFrame me

        if pXMLObj.doneParsing () then

          gMetrofeed = pXMLObj.makeList ()

        else

          go the frame

        end if

      end

       

       

      I can list gMetrofeed and it all scrolls just fine in the Message box using the local method. It takes 4 minutes to scroll everything. Now, if I can just get it to work using the URL, then I have the second task, which is pulling out just the nuggets of info I want to use and assigning each to a variable and a text castmember.

       

      Any help appreciated.

       

      Thanks!

        • 1. Re: URL not working
          Sean_Wilson Adobe Community Professional

          It's difficult to focus on exactly what your problem is, but it sounds like you're having difficulty accessing a password protected XML file on a web server somewhere - is that correct? Just because it works in a browser should not suggest it will work in Director, especially when you bring in odd URL syntax like 'username:password@URL'

           

          I would suggest trying "regular" netLingo to access the file and then using the XMLParser xtra to parse the (string) result: getNetText(), netDone() and netTextResult(). If that fails you might try the optional property list syntax with getNetText(), or append the username and password to the URL string.

           

          BTW: the line of code you posted

          "username:password@http:www.mycompany.com/getfeed.dll"

          possibly doesn't work as you missed the forward slashes in the URL - I assume though that this is a typo

          "username:password@http://www.mycompany.com/getfeed.dll"
          • 2. Re: URL not working
            thaiworthy Level 1

            Yes, the omission was a typo. Should have added the //.

             

            I went to the "Forms and Post" example in the Director Learning folder that uses the GetNetText command and typed in the actual URL I needed instead of www.adobe.com and it returned the following error message. Net error 4146. Connection could not be established with the remote host.

             

            ???

             

             

            • 3. Re: URL not working
              Sean_Wilson Adobe Community Professional
              I went to the "Forms and Post" example in the Director Learning folder that uses the GetNetText command and typed in the actual URL I needed instead of www.adobe.com and it returned the following error message. Net error 4146. Connection could not be established with the remote host.

              So do what I suggested and try the optional propList to send username/password, or append them to the URL. I'll ask around and see if someone can help with the difference between what you're trying (username:password@URL) and what I suggested.

               

              That is:

              tNetID = getNetText("http://www.company.com/getfeed.dll", ["username": your_username, "password": your_password])
              

              or:

              tNetID = getNetText("http://www.company.com/getfeed.dll?username=" & your_username & "&password=" & your_password)
              • 4. Re: URL not working
                Sean_Wilson Adobe Community Professional

                It's possible your URL was formatted incorrectly. Did you try:

                "http://username:password@www.mycompany.com/getfeed.dll"
                • 5. Re: URL not working
                  thaiworthy Level 1

                  Yes, that is exactly the way it worked in the browser too, but no luck 

                  in Director.

                  • 6. Re: URL not working
                    Sean_Wilson Adobe Community Professional

                    So what happens with the propList option or with the parameters passed in the URI?

                    • 7. Re: URL not working
                      thaiworthy Level 1

                      I created a behavior in frame one and ran the movie with this code:

                       

                       

                       

                      on enterframe

                       

                      global tNetID

                       

                         tNetID = getNetText ("http://www.mycompany.com/~company_dev/atlnta.xml

                      ",["username":myusername_dev,"password":123456])

                       

                      end

                       

                       

                       

                      An error came up that said script error: variable used before assigned 

                      a value.

                       

                      So then I changed it to:

                       

                       

                       

                      on enterframe

                       

                      global tNetID

                       

                       

                         tNetID = getNetText ("http://www.mycompany.com/~company_dev/atlnta.xml?username=

                      " & myusername_dev & "&password=" & 123456)

                       

                      end

                       

                       

                       

                      And I got the same error message. Had I not got the error, I would 

                      have typed put list tNetID in the message box to see what the list was.

                      • 8. Re: URL not working
                        Sean_Wilson Adobe Community Professional
                        I created a behavior in frame one and ran the movie with this code:

                         

                        on enterframe

                         

                        global tNetID

                         

                           tNetID = getNetText ("http://www.mycompany.com/~company_dev/atlnta.xml

                        ",["username":myusername_dev,"password":123456])

                         

                        end

                         

                         

                        An error came up that said script error: variable used before assigned 

                        a value.

                        That should be:

                        on enterFrame
                          global tNetID
                        
                          tNetID = getNetText ("http://www.mycompany.com/~company_dev/atlnta.xml", ["username": "myusername_dev", "password": 123456])
                        end
                        

                        and

                        on enterFrame
                          global tNetID
                        
                          tNetID = getNetText("http://www.mycompany.com/~company_dev/atlnta.xml?username=myusername_dev&password=123456" )
                        end
                        
                        • 9. Re: URL not working
                          Sean_Wilson Adobe Community Professional

                          I have asked around and done some research/testing and here's what I've discovered: you won't get this to work with NetLingo. Fortunately however, the SecureNet Xtra works. It may also be possible to use the Multiuser xtra in text mode to manage the HTTP transaction/s required, but I didn't pursue this any further.

                          • 10. Re: URL not working
                            thaiworthy Level 1

                            The company decided to give me a text file with just what I needed. 

                            Instead of going out on the internet to get it, they will send it to 

                            the computer. There were 3 XMLs to be parsed and it involved a great 

                            deal of work to extract and combine the data internally. I keep 

                            telling them this is just a presentation program. They wanted to use 

                            it as a browser and that didn't pan out either. Now I can sleep at 

                            night. Thank you for trying.