set server time to php variable and get with c2?

Discussion and feedback on Construct 2

Post » Tue Jul 12, 2016 3:06 pm

hello guys
how can i do this and get the current time of server ?
B
11
S
3
G
3
Posts: 50
Reputation: 2,281

Post » Thu Jul 14, 2016 6:01 pm

any one?
B
11
S
3
G
3
Posts: 50
Reputation: 2,281

Post » Fri Jul 15, 2016 4:58 am

@sadism

create a php file called something like: servertime.php

with contents:
<?php
header('Access-Control-Allow-Origin: *');
$dt = new DateTime();
echo $dt->format('Y-m-d H:i:s');
?>

then use an ajax call from within C2 that calls that php file. In the On Complete event, the date and time will be in the AJAX.LastData field.
B
95
S
33
G
20
Posts: 438
Reputation: 17,640

Post » Fri Jul 15, 2016 7:19 am

i do this bro thanks
Last edited by sadism on Fri Jul 15, 2016 8:39 am, edited 1 time in total.
B
11
S
3
G
3
Posts: 50
Reputation: 2,281


Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests