Hello,
Our server can not receive POST data via https from game client.
Help me please!! We don’t event know why this is happening. [import]uid: 9190 topic_id: 28799 reply_id: 328799[/import]
Hello,
Our server can not receive POST data via https from game client.
Help me please!! We don’t event know why this is happening. [import]uid: 9190 topic_id: 28799 reply_id: 328799[/import]
What headers are you sending? Do you have any sample code or a snippet? [import]uid: 58885 topic_id: 28799 reply_id: 116040[/import]
Many PHP servers have trouble with POST requests from Corona and I suspect it’s because it’s not setting the Content-Type header correctly.
Basically you have to set the Content-Type header to: “application/x-www-form-urlencoded”;
$headers[“Content-Type”] = “application/x-www-form-urlencoded”;
and pass the headers to the network.request() function as part of the post call. Should be tons of examples running around.
I switched to GET for my stuff to avoid the problem, but if you google “php post empty” you will see this is a common problem for PHP. [import]uid: 19626 topic_id: 28799 reply_id: 116104[/import]
Hello,
We’ve tried both $headers[“Content-Type”] and $headers[“Content-Length”].
Is there anything like CURLOPT_SSL_VERIFYPEER that coronalabs should have their attention and investigate in this case? We though the problem is cause of CORONA’s network component. But we don’t know what C++ library they have used in their source code.
For more information about CURLOPT_SSL_VERIFYPEER
FALSE to stop cURL from verifying the peer’s certificate. Alternate certificates to verify against can be specified with the CURLOPT_CAINFO option or a certificate directory can be specified with the CURLOPT_CAPATH option. TRUE by default as of cURL 7.10. Default bundle installed as of cURL 7.10. [import]uid: 9190 topic_id: 28799 reply_id: 116155[/import]
Op!!! Our develop have found out what is happening!!
Here is what is printed out by CORONA
07-20 09:18:22.605: INFO/Corona(6113): Key isError value true
07-20 09:18:22.605: INFO/Corona(6113): Key name value networkRequest
07-20 09:18:22.605: INFO/Corona(6113): Key response value No peer certificate
07-20 09:18:22.605: INFO/Corona(6113): Network error
Our $12 SSL certificate have issused by Godaddy, it’s should OK for every client.
But, we though that CORONA has block our request’s response.
Our service endpoint with valid ssl certificate: https://rubycell.com/test.php
[lua]require “ActionButton”
local text = display.newText("",0,0,native.systemFontBold,20)
text.x = display.contentWidth/2
text.y = display.contentHeight/2
local btnAction = ActionButton {
normal = display.newImage(“btnBlueMedium.png”) ,
active = display.newImage(“btnBlueMediumOver.png”)
}
btnAction.x = display.contentWidth/2
btnAction.y = 3*display.contentHeight/4
btnAction:addEventListener(“performAction”,function(event)
local function listener(event)
for key , value in pairs(event) do
print("Key " … key … " value " … tostring(value))
end
if event.isError then
print(“Network error”)
text.text = “Network error”
else
print(tostring(event.response))
text.text = tostring(event.response)
end
end
local url = “https://rubycell.com/test.php”
method = “POST”
network.request(url,method,listener,{body = “params=daddd¶m1=dsdhd”})
end)[/lua]
P/S: CoronaLabs should read this
http://stackoverflow.com/questions/2012497/accepting-a-certificate-for-https-on-android?lq=1
OR
Give us some functions to set these verify options:
ALLOW_ALL_HOSTNAME_VERIFIER
BROWSER_COMPATIBLE_HOSTNAME_VERIFIER
STRICT_HOSTNAME_VERIFIER [import]uid: 9190 topic_id: 28799 reply_id: 116159[/import]
we’ve fixed this by install ssl correctly (with intermediate cert) [import]uid: 9190 topic_id: 28799 reply_id: 116609[/import]