PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i was trying to make a script that will process sms message and if its content is with a specific month,day and time to update it to my calendar appointment and set it to occupied...this is how i started,i need help for the rest...i would appreciate any help guys...
<?php
$webhook_secret = 'mysecret';
if ($_POST['secret'] !== $webhook_secret)
{
header('HTTP/1.1 403 Forbidden');
echo "Invalid webhook secret";
}
else
{
if ($_POST['event'] == 'incoming_message')
{
$content = $_POST['content'];
$from_number = $_POST['from_number'];
$phone_id = $_POST['phone_id'];
if($_POST['content']== 'October-4-2012-1700'){
=>i need here the code to now update the calendar appointment at october 4,2012,17:00 and set it to occupied<=
=>the code for incoming sms message is working i just need the rest for updating<=
}
}
}
This is a picture of the calendar.
Last edited by shile on Sat Oct 06, 2012 8:11 am, edited 1 time in total.
First look at PHP's DateTime class (http://us2.php.net/manual/en/book.datetime.php). Specifically the createFromFormat() method. That will make the date from $_POST useful. Then you can get the year, month, day, hour and minute to set in the calendar database.
this method requires php version 5.3 but my version on joomla is 5.2...but nevermind i will update it,but what to do next when i format my content to a date,how to set it to my calendar?
i figured it out how to use the string in the content and format it to date,but now i need to use that information and update my calendar...any help guys or maybe you christopher?i need this to work...
no,you misunderstood me apparently...i already implemented calendar in joomla,now i need to use the information in a string and throught a php script set for the specific date and time that the appointment is occupied as shown in the picture...
shile wrote:i need to use the information in a string and throught a php script set for the specific date and time that the appointment is occupied as shown in the picture...
So the script will be given a date and time. You want the script to find if that appointment is occupied in the calendar data table? Or to set the appointment as occupied?