-
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.
-
FK'n_dog
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);
-
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?
-
FK'n_dog
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
-
Thank You!!
Thank you very much!
You have helped me a lot!!
Best wishes from a flashloving girl from Oslo, Norway
-
FK'n_dog
you're welcome, flashloving girl from Oslo
-
C Sharp Proxy
Hello
Does anyone know how to do this in C#/C Sharp?
Thanks // Martin
-
FK'n_dog
makr - post your question in the Scripting and Backend forum
-
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;
}
}
}
}
-
Originally Posted by a_modified_dog
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|