One way to get around the hassle of a common security error when trying to call a HTTPService running on a different domain than your Flex application is to use a simple and local PHP script as a proxy to call the HTTPService for you. Perhaps not a solution you would want to use if you need to load massive piles of data but in most cases it works just fine and takes seconds to set up.
proxy.php
$content = file_get_contents(str_replace(' ','%20',$_GET['url']));
if ($content !== false) {
echo($content);
} else {
// there was an error
}
HTTPService in MXML
<mx:HTTPService id="myService"
url="http://www.localdomain.com/proxy.php?url=http://www.remote.com/api"/>
muchas gracias por el código.
ReplyDeleteEs la solución más simple que he econtrado en la red y lo que primero me funcionó.
Saludos