Posted By

weavermedia on 12/01/10


Tagged

php as3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

weavermedia
adrianparr


AS3 Get the time/date from the server with a simple PHP script


 / Published in: ActionScript 3
 

  1. // AS3 code loads the contents of getDate.php
  2.  
  3. var ldr:URLLoader = new URLLoader()
  4. ldr.load(new URLRequest("http://www.YOUR-URL.com/getDate.php"))
  5. ldr.addEventListener(Event.COMPLETE, onLoaded)
  6. function onLoaded(evt:Event){
  7. trace(ldr.data)
  8. }
  9.  
  10. // getDate.php sits on a server you can access
  11. // and simply outputs the date - the (j) tells it to output the date as a number
  12. // check http://uk.php.net/manual/en/function.date.php for more options on the output
  13. // script contents below (without the comment slashes of course):
  14.  
  15. //<?php
  16. //print "&serverDate=".date(j);
  17. //?>

Report this snippet  

You need to login to post a comment.