A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: [Resolved] [Resolved] ANNC: save to foreign server

  1. #1
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi there,

    I have written some code that overcomes the foreign server restriction by using loadmovie rather than loadvariables.
    This technique should help all those who have their website on a non-scripted server and can get some additional scripted webspace elsewhere (e.g. 5 MB at http://www.vr9.com)
    I have set up some public test site where you can load and save variables, but this approach could also be used for mail scripts
    To use it, replace the basic
    Code:
    status = 'unknown';
    loadVariablesNum('http://yoursite.com/somecode.cgi', 0, 'POST')
    // next frame - blank
    // next frame:
    if(status == 'unknown') prevFrame();
    or similar code sequence by this one for saving
    Code:
    // you need an empty "data" movieclip on the stage...
    function i_am_here()
    {       status = data.status;   // fetch status
            play();
    }
    data.op = 'save';       // you want to save
    data.pass = 'secret';   // access control
    data.var1 = value1;     // put all vars here that you want to save
    data.loadMovie('http://www.fontimages.f2s.com/cgi-bin/loadsave.cgi','POST');
    stop(); // and possibly show 'server busy' animation
    The code for loading data is similar
    Code:
    // you need an empty "data" movieclip on the stage...
    function i_am_here()
    {       status = data.status;   // fetch status, if any
            var1 = data.var1;       // and all vars you are interested in
            play();
    }
    data.op = 'load';       // not really needed, but seems to help caching headaches
    data.loadMovie('http://www.fontimages.f2s.com/cgi-bin/loadsave.cgi','POST');
    stop(); // and possibly show 'server busy' animation
    Obviously I cannot save all variables on the internet so there is just one text file shared between all testers. If two people try out this script at the same time, variables might simply get mixed up
    BTW: code will only be released if enough of you guys tell me that it works

    Musicman

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Posts
    475
    Hi musicman

    Works for me - i rebuilt your (great!!) idea behind that with PHP and Ming in a few minutes...

    Well i don't need this workaround, but it's interesting how easily security holes can be opened... same goes for most browsers and cookies, but that's another story

    Yours
    HTD

  3. #3
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039

    send mail via 3rd party CGI

    Hi,

    here is another one...
    You need a movie that either loads its mailform in a movieclip or that uses a movieclip for sending and receiving data
    If you use a separate clip called "data", the code on the
    submit button would be similar to
    Code:
    on(release) {
    data.recipient = 'recipienthere';
    data.email = _root.email; // sender's email
    data.message = _root.message; // message to be sent
    data.error = ''; // no error
    data.loadMovie('http://www.fontimages.f2s.com/cgi-bin/3rdpartymail.cgi', POST);
    play();  // goto next frame - and probably show "server busy" animation.
    }
    When mail is (not) sent, a function i_am_here in the parent (usually _root) will be called. This could be
    Code:
    function i_am_here()
    { if(data.status = 'ok')
        gotoAndPlay('success');
      else
      { error = data.error; // show error message - bad email or such
        prevFrame(); // show form again
      }
    }
    BTW: This is just for testing. If your movie works with it, go find a scripted server and install the script there. I am logging all requests - if it turns out somebody uses this for spamming, I will have to stop it

    Musicman

  4. #4
    Senior Member
    Join Date
    May 2001
    Posts
    335

    Thumbs up

    Yeah, it looks cool, but MusicMan can you clarify this technique for me, please??

    According to Flash help manual:
    anyMovieClip.loadMovie(url [,variables]);
    Arguments
    url An absolute or relative URL for the SWF file to load. A relative path must be relative to the SWF. The URL must be in the same subdomain as the URL where the movie currently resides. For use in the Flash Player or for testing in test-movie mode in the Flash authoring environment, all SWF files must be stored in the same folder, and the file names cannot include folder or disk drive specifications.

    So how is it working???


  5. #5
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    the "same subdomain" restriction only applies to loadvariables, not to loadmovie ....

    Musicman

  6. #6
    Senior Member
    Join Date
    May 2001
    Posts
    335
    Thanks a lot....




  7. #7
    Senior Member
    Join Date
    Jan 2001
    Posts
    191
    It looks like this would overcome some rstrictions with loadVariables, but how about loading XML? Most of the apps that I write are using XML, and especially the XML:ACK written by Fig Leaf Software.

    Since loading the same amount of data with a loadVariables or loadMovie would pretty much bring any PC to it's knees(sometimes up to 300K!), I need an XML solution. Any working examples?

  8. #8
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    I have not tried so far. But I think you can process a string with XML content...

    Musicman

  9. #9
    Senior Member
    Join Date
    Jan 2001
    Posts
    191
    True, but that doesn't speed up the load time. I tried loading a single variable that was pipe "|" delimited, and the 30K file pretty much stops the Flash app while it's chewing on that data, and makes the movie look like it's locked up. And if you have any other windows/apps open, you're guaranteed to get a script warning.

    My system's a 650 with 320 Megs of memory, so imagine what would happen on anything even slightly slower!

    There's got to be a better way to pull in remote XML...

  10. #10
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    Is that just loading one variable, like
    data=very long string

    You should try to read up a bit on XML Nitro, maybe you find some hints about the loading as well. I think something was mentioned in an "undocumented features" thread a few weeks ago

    Musicman

  11. #11
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    Check this thread as well.

  12. #12
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi David,

    I know about proxying, and it is probably the way to go if several sites share a common database (e.g. travel agents all running their own sites but using a central facility for flight and hotel reservation). Even then your approach might be handicapped by some servers not allowing outgoing connections. Someone paying for a small hosted site might not be able to convince the hosting company to change their overall firewall policy, and I believe many hosting companies would not be able to tell you before signing up.

    My approach is designed for sites where the own server does not handle scripting at all (like geocities), so they can setup their mail, login or similar stuff at a different site.

    Musicman

  13. #13
    Senior Member
    Join Date
    Jan 2001
    Posts
    191
    Actually, i'm using the XML:ACK, which proved to be better than XMLNitro. Loading the XML previous to adding XML:ACK was slwo as well, but still faster than reading in a text string. And to answer the question, I was rading in one loooong string:

    TRACK_LIST=some_text|more_text|even_more_text...

  14. #14
    Senior Member
    Join Date
    Jun 2001
    Location
    Bay Area, CA
    Posts
    170
    Musicman,

    i used this code:
    on(release) {
    data.recipient = 'recipienthere';
    data.email = _root.email; // sender's email
    data.message = _root.message; // message to be sent
    data.error = ''; // no error
    data.loadMovie('http://www.fontimages.f2s.com/cgi-bin/3rdpartymail.cgi', POST);
    play(); // goto next frame - and probably show "server busy" animation.
    }

    I found another server that i could put the cgi script on. Can you please direct me to a place where i can put that script. I don't know Perl or any of that, so could you help me w/ configuring it? thanks

  15. #15
    hi
    i tried to do a similar thing in php, used a simple code to add 1 to a number in a text file.
    the load movie thing works ok as far as it runs the script ( the number in the text file gets bigger), but I cant seem to read the variable in to flash.

    I'm new to php so I hope i'm doing something simple wrong. I tried to use echo and print to get the variable back into flash but to no avail.


    arrg

    any help would be appreciated

    eyesoar

  16. #16
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    can you show me the script you are actually using, and the url to the movie?

    Musicman

  17. #17
    thanks i'll mail you

  18. #18
    Hey eyesoar, I'm trying to do almost the exact same thing, only you've got it over on me - I can't get anywhere with it. Musicman, any chance for a breakdown of what is happening in your script? I see functions being defined, but not being called anywhere. Do you attach them to the data mc instance? Still plugging away . . .

  19. #19
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    there are two parts to it - the actionscript loads a data mc with the info to be sent (could also be sending the main timeline, but this way it is explicit what info is sent) and then calls for loadMOVIE(). The script on the server does whatever it is supposed to (sending mail, in this case) and then constructs a blank (no graphics at all) swf movie to answer the call. The only thing inside that movie is some actionscript setting variables - as well as a call to function i_am_here in the calling movie which will in turn process the data inside the movie.
    The only black art is building a swf movie without using the flash program. Source code for server script is at http://www.fontimages.f2s.com/cgi-bin/3rdpartymail.cgi?op=code

    Musicman

  20. #20
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    there are two parts to it - the actionscript loads a data mc with the info to be sent (could also be sending the main timeline, but this way it is explicit what info is sent) and then calls for loadMOVIE(). The script on the server does whatever it is supposed to (sending mail, in this case) and then constructs a blank (no graphics at all) swf movie to answer the call. The only thing inside that movie is some actionscript setting variables - as well as a call to function i_am_here in the calling movie which will in turn process the data inside the movie.
    The only black art is building a swf movie without using the flash program. Source code for server script is at http://www.fontimages.f2s.com/cgi-bin/3rdpartymail.cgi?op=code

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center