Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS3: How to restrict urlvariables to send variables with POST method?

Guest
Jul 24, 2013 Jul 24, 2013

Hi Everyone,

I am struggling with urlvariables of AS3, they are sending variables with GET method while i am using POST method, Please help,

Here is my code:

----

AS3

----

req = new URLRequest(url);

user_lead = new URLVariables();

vars['email'] = "test@test.com";

vars['content']= "dummy Contents here";

req.data = vars;               

req.method = URLRequestMethod.POST;               

ldr = new URLLoader();

ldr.dataFormat = URLLoaderDataFormat.TEXT;

//ldr.dataFormat = URLLoaderDataFormat.VARIABLES;

ldr.addEventListener(Event.COMPLETE, checkResponse);

ldr.addEventListener(IOErrorEvent.IO_ERROR, IOErrorHandler);

ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);               

ldr.load(req);

navigateToURL(req);

-----

PHP:

-----

<?php

   

    echo $_POST["email"];      //NOT WORKING

    //echo $_REQUEST["email"];  working fine

    //echo $_GET["email"];  working fine

   

?>

Thanks,

Maani

TOPICS
ActionScript
566
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2013 Jul 24, 2013

1. remove that navigateToURL

2. what is vars?

3. what's the purpose of user_lead?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 24, 2013 Jul 24, 2013
LATEST

You should be using the var "user_lead" to set your vars and pass that to the .data property.

e.g.

var req:URLRequest = new URLRequest(url);

var user_lead:URLVariables = new URLVariables();

user_lead.email = "test@test.com";

user_lead.content = "dummy Contents here";

req.data = user_lead;              

req.method = URLRequestMethod.POST;              

ldr:URLLoader = new URLLoader();

ldr.dataFormat = URLLoaderDataFormat.VARIABLES;

ldr.addEventListener(Event.COMPLETE, checkResponse);

ldr.addEventListener(IOErrorEvent.IO_ERROR, IOErrorHandler);

ldr.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);              

ldr.load(req);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines