Here is roughly how I did that:
http://www.jamesborder.local/URLRequest.php (your url should be wherever your data is)
<?php
// create an array to put your junk in… then put it there
$variablesArray = array();
$variablesArray['var1'] = “foo”;
$variablesArray['var2'] = “bar”;
// let php build a nice string for you
$variablesArrayString = http_build_query($variablesArray);
echo $variablesArrayString;
// var1=foo&var2=bar
?>
-=-=-=-=-=-=-=-=-=-
Here is roughly what is in the .fla
// build your request…. your url/file will go here
var request:URLRequest = new URLRequest(“http://www.jamesborder.local/URLRequest.php”);
request.method = URLRequestMethod.GET;
// create
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, onCompleteHandler);
loader.load(request);
function onCompleteHandler(event:Event) {
trace(“completeHandler(“+event+”)”);
var var1 = event.target.data.var1;
var var2 = event.target.data.var2;
trace ('variable one: ' + var1);
trace ('variable two: ' + var2);
}
Loading external PHP data using URLRequest
Apr, 18 -- Categories: PHP