A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Server-side proxy method

  1. #1
    Junior Member
    Join Date
    Sep 2006
    Posts
    7

    Server-side proxy method

    A nice user here let me know that i need Server-side proxy method to get xml from another domain.

    To day i have a flash movie that works perfect locally on machine but not when it on my webserver. My xml is from a server/domain that i have no control over. (public xml ex. newspaper)

    I need to use the Server-side proxy method to be allowed to get the date from another domain.
    I have downloaded the php script i need to use from the macromedia site but i do not know how to implement.

    To day i have a normal :
    images_xml.load("whatever.xml");
    that loads data in to my flashmovie.
    (works perfect locally)

    Can anyone tell med how to connect to my proxy.php file that allows my movie to get data from other domains?

    Step by step...

    Please... i`m really stuck here.

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    upload this proxy.php to your server -
    PHP Code:
    <?php
    $dataURL 
    "http://www.otherdomain/some.xml";
    readfile($dataURL);
    ?>
    and load the php file into to your movie -
    Code:
    verTime = new Date().getTime();
    feed = "http://www.yourdomain/proxy.php?";
    
    myXML.load(feed+verTime);

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Posts
    7

    xml start with...

    Someone told me that the xml cant start with:

    <?xml version="1.0" encoding="utf-8" ?>

    Is that right?

    I cant control that... (i do not make the xml)

    Can i still use the method you gave me?

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Someone told you BS

    All XML documents can optionally begin with an XML declaration.

    <?xml version="1.0"?>

    Currently, 1.0 is the only approved version of XML

    The XML declaration can also specify the character encoding used in the document:

    <?xml version="1.0" encoding="UTF-8"?>

    All XML parsers are required to support the Unicode “UTF-8” and “UTF-16” encodings

    Can i still use the method you gave me? -- YES

  5. #5
    Junior Member
    Join Date
    Sep 2006
    Posts
    7

    Thank You!!

    Thank you very much!
    You have helped me a lot!!
    Best wishes from a flashloving girl from Oslo, Norway

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    you're welcome, flashloving girl from Oslo

  7. #7
    Junior Member
    Join Date
    Jun 2009
    Posts
    2

    C Sharp Proxy

    Hello

    Does anyone know how to do this in C#/C Sharp?

    Thanks // Martin

  8. #8
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    makr - post your question in the Scripting and Backend forum

  9. #9
    Junior Member
    Join Date
    Jun 2009
    Posts
    2
    Its now a solution my friend =)
    So here is the C# version for thoose interested

    proxy.ashx
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Xml.Linq;
    
    namespace WWW.Flash
    {
        /// <summary>
        /// Summary description for $codebehindclassname$
        /// </summary>
        public class proxy : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
                XElement xml = XElement.Load(context.Server.MapPath("URL_TO_FILE_GOES_HERE"));
                context.Response.ContentType = "text/xml";
                context.Response.Write(xml.ToString());
                context.Response.Flush();
                context.Response.End();
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }

  10. #10
    Banned
    Join Date
    May 2012
    Posts
    1
    Quote Originally Posted by a_modified_dog View Post
    upload this proxy.php to your server -
    PHP Code:
    <?php
    $dataURL 
    "http://www.otherdomain/some.xml";
    readfile($dataURL);
    ?>
    and load the php file into to your movie -
    Code:
    verTime = new Date().getTime();
    feed = "http://www.yourdomain/proxy.php?";
    
    myXML.load(feed+verTime);
    Thanks man i need this information too .

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