Background:
I am building a simple chat program for iOS/Android. On the backend is an equally simple PHP/MySQL server that handles the messages. In some cases messages need to be delayed and not sent immediately. To handle this function I an sending messages via HTTP to a server that schedules when messages will be released. The format that it follows is below:
http://www.company.com:8899/?Env=env&AppName=####&Token=string
&Message=string&ScheduleDate=2010-08-31%2022:10:34%20-0400
&ScheduleAction=action
The most relevant part of the URL for this question is ScheduleDate which specifies the time/date that the message will be sent
Question:
I am having trouble getting the current date/time, putting it in the required format (YYY-MM-DD HH:MM:SS) and then accounting for the required delay. What I want to do is:
(1) get the current date/time
(2) add 5 minutes
(3) put it back into that URL string
Here is the segment with which I am building the string. I used $roomCreateDate to try and get the current date just to see if I could build the string without accounting for the delay. $comand should build the string to match the format above.
$roomCreateDate = date("Y-m-d H:i:s");
$command = 'localhost:8899/'.
'?Env='. environment($appversion) .
'&AppName=EchoFriendly'.
'&Token=' . $devicetoken .
'&Message=' . urlencode($apsPayload) .
'&ScheduleDate=' . urlencode($roomCreateDate) .
'&ScheduleAction=add';
Any help is appreciated
1 Answer