posting data to web server

Hi,
I am currently trying to set up my app to send data to my webserver using the network.request() function.

Currently, on my main.lua I have this:
[lua]local function networkListener( event )
if ( event.isError ) then
print( “Network error!”)
else
print ( "RESPONSE: " … event.response )
end
end

local params = {}

email = “hello”

params.body = email

network.request( “http://127.0.0.1/new/verify.php”, “POST”, networkListener, params)[/lua]

On my PHP file, I have
[php]

echo ($_POST);
[/php]

However, I do not know what the data is being sent as, and therefore have no idea what to put in the square brackets after POST – does anyone know?

Thanks
[import]uid: 24641 topic_id: 16252 reply_id: 316252[/import]

anyone at all? [import]uid: 24641 topic_id: 16252 reply_id: 60566[/import]

I need this, any help… [import]uid: 24641 topic_id: 16252 reply_id: 60854[/import]

In your PHP code try using this instead:

[php]

print_r($_POST);

[/php] [import]uid: 5833 topic_id: 16252 reply_id: 60870[/import]

that returns

Array ( ) [import]uid: 24641 topic_id: 16252 reply_id: 60899[/import]

any ideas? [import]uid: 24641 topic_id: 16252 reply_id: 61158[/import]

If you need a lot of support/sample code/etc. you can get assistance here; http://www.anscamobile.com/corona/support if you are in a hurry.
[import]uid: 52491 topic_id: 16252 reply_id: 61220[/import]

Well that should work. I don’t use PUT but GET.

[lua]network.request( “http://mysite.com/api/login.php?playername=” … mime.b64(username) … “&password=” … mime.b64(password), “GET”, callback )[/lua]

then in my PHP:

if(isset($\_GET)) {  
 $playername = base64\_decode($\_GET["playername"]);  
 $password = base64\_decode($\_GET["password"]);  
}  

I seem to remember that I started using PUT and had problems. Maybe I was running into the same problem. I found this while looking at the problem:

http://www.bradino.com/php/empty-post-array/

Perhaps the headers are not correct. Anyway, unless you are sending a lot of data, try using GET.

[import]uid: 19626 topic_id: 16252 reply_id: 61228[/import]

thank you rob miracle! I used GET instead and now it works perfectly, thanks a lot! [import]uid: 24641 topic_id: 16252 reply_id: 61267[/import]

I wonder if there is a bug in Corona with regards to PUT then. If I get ambitious, I may test it out, but I’d rather spend my energy on finishing my game right now. [import]uid: 19626 topic_id: 16252 reply_id: 61286[/import]

I too had been using “POST” until I found this thread, changed to “GET” and now my php script works as it should… [import]uid: 19620 topic_id: 16252 reply_id: 115154[/import]