Communicating to cgi on a different domain/ server

G’day all!

I’ve never attempted this before and would appreciate some advice on connecting to server-side scripts at a different domain.

For example, on one domain would be the main site with all the .swf’s, but the database containing the relative information is on a different domain and the two need to communicate with each other.

Would I use the LocalConnection object or if possible, could someone post an example to connect to a .php file on a different server than the .swf that is calling it.

The main issue why I’m asking is the main site server is nt with asp and I need to call a php file to connect to a database whereby both are on a *nix server.

Any assistance would be helpful, thanks.

So I’ve tried the following code:


var my_lv = new LoadVars();
 my_lv.onData = function(src) {
  if(src==undefined){
   output_txt.text = "Unable to connect to server!";
  }else{
   output_text.text = src;
  }
 }
 my_lv.load("http://www.mydomain.com/returnData.php?foo=iamdata");

When I test this I get my custom error msg because there was no data loaded.
I’ve even put a crossdomain.xml file where the .swf is stored to accept the domain where the test php script is stored.

Can anyone give me a hand?

I’ve modified it to test locally ( see below ) and it works but if I try to access the exact same script on a different domain it returns ‘undefined’.


var my_lv = new LoadVars();
my_lv.onLoad = function() {
  _root.output_txt.text = my_lv.foo;
 }
}
my_lv.load("http://localhost/returnData.php?foo=iamdata");