Sunday, October 11, 2009

Flex and PHP POST

I always forget the syntax when trying to get around the Flex sandbox and use PHP. On the Flex side we need the following:

[Bindable]private var pr_url:String;

private function init():void
pr_url = "url to SOAP service for example";


<mx:HTTPService id="pr" resultFormat="e4x" result="getMonths_result(event);" fault="getMonths_fault(event);" method="POST" url="">
<mx:request xmlns="">

On the PHP side:


header('Content-Type: text/xml');
$url = $_POST["url"];

$data = file_get_contents($url);
echo $data;

No comments: