开发者

AS3 - Sending POST data to another domain without loading (Sandbox security)

I need to send POST Data to a ASP script on a different domain name ( without loading data).

var scriptRequest :URLRequest = new URLRequest( 'http://someExternalCart.com/cart.asp' );
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;

It works with navigateToUrl, BUT I don't want to get redirected to that page, I only want to send the data.

I have tried this:

var ldr :URLLoader = new URLLoader();
ldr.load( scriptRequest );

But I am getting the sandbox security error.

Is there any other way of sending the data without re开发者_JAVA百科direction/page reload and without loading (which causes the security error)?


If you don't have access to the server to add the crossdomain.xml security policy file, you will need to set up a proxy on your own server that passes the request through for you (something like http://xmlrpcflash.mattism.com/proxy_info.php).


To avoid sandbox error, you need a crossdomain file on "http://someExternalCart.com/".

http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

Or you can use a script (php, asp...) on your webserver that will act as a proxy.

http://www.snorkl.tv/2011/04/get-data-into-flash-from-other-domains-with-crossdomain-xml-or-php-proxy-script/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜