-
-
2. Re: retrieve and save data to the cloud
Stephdidou Nov 6, 2014 1:52 PM (in response to kglad)Hmm my question wasn't about how to retrieve the device ID, but how to save and send data to the cloud.
Can I send the information in mySharedObject to a website ?
Steps I'd like to do (but don't know how) :
- Convert mySharedObject into a json or text format
- send the txt file or json file to http://www.exemple.com/data.txt
Thank you !
-
3. Re: retrieve and save data to the cloud
kglad Nov 6, 2014 2:44 PM (in response to Stephdidou)use the urlloader class to send data to your server. the only tricky part is, "I need their devices ID" and that's why i posted the link in message 1.
-
4. Re: retrieve and save data to the cloud
Stephdidou Nov 6, 2014 4:26 PM (in response to kglad)I'm trying to use urlLoader but it's not working and I don't know why..
I've created a php file that I have uploaded. Here's the php code :
<?php
$psPreRegEmail=$_POST['sEml'];
$FRM_ID=$_POST['sID'];
$psBD=$_POST['sBD'];
echo "email=".$psPreRegEmail;
echo "&id=".$FRM_ID;
echo "&db=".$psBD;
?>
Here is my AS3 code :
var request:URLRequest = new URLRequest("http://www.mysite.fr/login.php");
var variables:URLVariables = new URLVariables();//create a variable container
variables.sEml = "steph4";
variables.sID = "steph5";
variables.sBD = "steph6";
request.data = variables;//add the data to our containers
request.method = URLRequestMethod.POST;//select the method as post
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, handleComplete);
loader.load(request);//send the request with URLLoader()
function handleComplete(event:Event)
{
var loader:URLLoader = URLLoader(event.target);
var vars:URLVariables = new URLVariables(loader.data);
//Access data from the PHP file
trace("vars.email: "+vars.email);
trace("vars.id: "+vars.id);
trace("vars.db: "+vars.db);
}
No errors, but when I'm going at http://www.mysite.fr/login.php it displays : email=&id=&db=
Why don't I see : ???
email=steph4
id=steph5
db=steph6
Thx
-
5. Re: retrieve and save data to the cloud
Stephdidou Nov 6, 2014 4:39 PM (in response to kglad)I'm starting to wonder if it's possible to send data from an AIR app to a php file on a server ??
-
6. Re: retrieve and save data to the cloud
kglad Nov 7, 2014 6:46 AM (in response to Stephdidou)i don't see a problem with your code, but i'm not sure how you're checking trace output from your air app.
-
7. Re: retrieve and save data to the cloud
dmennenoh Nov 12, 2014 9:59 AM (in response to Stephdidou)>>I'm starting to wonder if it's possible to send data from an AIR app to a php file on a server ??
Of course it is.



