dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: XML and Cookies?

  1. #1
    Multimedia devloper
    Join Date
    Oct 2001
    Location
    jordan-amman
    Posts
    80

    XML and Cookies?

    is it possible to store xml objects using cookies?
    I tried to, but I would love it if someone has this figured out
    just one object, thats all Im asking

    thx for your time

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    XML can be outputted as a string so it should be no problem to store it anywhere. Which cookies are you talking about? Browser ones or one in flashs file cache?

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  3. #3
    Multimedia devloper
    Join Date
    Oct 2001
    Location
    jordan-amman
    Posts
    80
    thx for the reply,
    yahh I'm talking about browser cookies,
    I tried to but when i retrieve the variables it seems to be converted to another format,
    I can try to reconvert them into XML format but i have many different cases that complicates the situation,
    is there an answer?

    thx again

  4. #4
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    I think you basically have to obtain the variables and then construct as you see fit:

    Save cookie (savecookie.php)

    PHP Code:
    <?
    $first
    ="A Fake Blog Example";
    $second="http://sandbox.serveftp.org";
    $third="A Fake News Story";
    $fourth="A really long string saved as a news description.HHHHHHHHHHHHHHHHHHHH
    HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"
    ;


    $expiryDate mktime(00012252030);
    setcookie('first' $first$expiryDate);
    setcookie('second' $second$expiryDate);
    setcookie('third' $third$expiryDate);
    setcookie('fourth' $fourth$expiryDate); 

    ?>
    Readback and construct (cookie.php):


    PHP Code:
    <?php
    $first 
    $_COOKIE["first"];
    $second $_COOKIE["second"];
    $third $_COOKIE["third"];
    $fourth $_COOKIE["fourth"];

    header("Content-Type: text/xml");
     
    echo 
    "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n";
    echo 
    "<rss version=\"2.0\">\n\n";
    echo 
    "<channel>\n";
    echo 
    "<title>" $first "</title>\n";
    echo 
    "<description>" $second "</description>\n";

        echo 
    "<item>\n";
        echo 
    "<title>" $third "</title>\n\n";
        echo 
    "<description>" $fourth "</description>\n";
       echo 
    "</item>\n\n";
      
    echo 
    "</channel>\n";
    echo 
    "</rss>\n";

    $filefopen("results.xml""w");

     
    fwrite($file$_xml);
     
    fclose($file);

     
    ?>

    Once you have the stored strings...start pushing them anywhere

    End result: http://sandbox.serveftp.org/cookie.php
    Last edited by Chris_Seahorn; 07-31-2005 at 10:55 AM.

  5. #5
    Multimedia devloper
    Join Date
    Oct 2001
    Location
    jordan-amman
    Posts
    80
    thx for the reply chris I really appreciate it,
    but were talking about shared objects not PHP
    u know! that browser cookie thing that saves simple variables on ur pc
    when i try to send an xml node through it the returned variables are not the same xml format, thats my problem

    thx again for your reply really usfull info u posted

  6. #6
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    yahh I'm talking about browser cookies,
    Sorry, that threw me...

    So retrieve the shared objects in your movie and send them out as POST to populate the xml or construct the node from send outs. Can be a seemless move. I use that (POSTS from my read SO's that decide sql returns rather than populating an xml tree) for my bans.
    Last edited by Chris_Seahorn; 07-31-2005 at 01:36 PM.

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