CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Updating calendar (http://www.codingforums.com/showthread.php?t=275207)

shile 10-05-2012 12:34 AM

Updating calendar
 
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 Code:

<?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.

http://i50.tinypic.com/hu4rgl.jpg

shile 10-05-2012 07:06 PM

any help guys?

tangoforce 10-05-2012 07:18 PM

There could be but you need to help us to help you. Take a few seconds to read the sticky topic about using [php] and [/php] tags to present your php code to us. There is a link to it in my sig.

Secondly, you've provided no information about how this sms text is going to get to your script. Are you sending it to a mobile that then initiates a http request? sms and http are two completely different protocols. If you don't give us anything to go on then we can't do much to help.

shile 10-05-2012 07:42 PM

i'm sorry for not setting it to php tags,i forgot...i dont think that is relevant how the sms message comes to my site,because i only need to use the content of that and from it to update my calendar.But maybe i'm wrong so i will tell you how i managed to set it,i have set sms gateway that redirects sms messages from my phone to my website...

tangoforce 10-05-2012 07:54 PM

Quote:

Originally Posted by shile (Post 1276707)
i'm sorry for not setting it to php tags,i forgot...

Ok then :thumbsup:

Quote:

Originally Posted by shile (Post 1276707)
i dont think that is relevant how the sms message comes to my site

On the contrary, it is.

I saw your post days ago and ignored it. Want to know why? Because the first thing I thought was "here is another I wanna do sms" post from someone who doesn't even realise how much is invoved. There is no way I'm going into a long explantion of how sms needs to be converted to a http post somewhere along the line every time I see a 'wannabe' post and so i skipped it. Why? Because I'd either end up being forced to try and help you write php to interface with a gsm modem OR write php to interface with an SMS gateway. That makes the problem look bigger and more time consuming than it really is.

If I'm thinking that way, how many others here were? - You see, that is why what you think about it not being important to tell us is wrong. We need to at least know that you're aware of what you're doing so that we know what we're up against. Now you've told us that you're using an SMS gateway it means that your problem is much smaller than it first looked. Therefore that makes it easier for us to help you. SMS gateways are no secret, all you had to do was mention that you were using one and one of us would of been able to help you days ago.

You have to think of this from the other peoples perspective. They have other things to do rather than sit around for hours writing an SMS interface for you for free. If you mention that you're using a SMS gateway then it eliminates that. Thats the way you need to think about it, making it as easy as possible for people to understand your problem and help you with it :thumbsup:

shile 10-06-2012 12:16 PM

i understand what you are saying but i didnt ask for help about sms interface,i already got that working...now i just need to process the content of sms message and then if it is the right format to update it in my calendar...now can you help me with that?

tangoforce 10-06-2012 12:23 PM

Unfortunately I've never done anything calender related (never needed to) so I'm not the best person to help out with it.

As for the sms thing, I appreciate you didn't ask about it but the very fact you mentioned SMS gives an impression that you may need help with that. If you had simply asked for help with a calender and not mentioned SMS then I'm sure you would have got help with it almost instantly (in fact you may be better off starting another topic about it and just skipping the sms bit completely).

shile 10-06-2012 01:57 PM

you may be right,thanks for all your help anyway...

shile 10-07-2012 12:16 PM

guys,any help?i need this to work...

Fou-Lu 10-07-2012 01:49 PM

Mkay. Lets start here:
PHP Code:

            if($_POST['content']== 'October-4-2012-1700'){ 

Is this of any particular meaning? The actual input value you have there in a string is a GNU compatible datetime format. Because it is, we can now convert that easily using DateTime or strtotime handling. This will be beneficial assuming that you don't want to write a conditional branch for each day and time block.

So what is it you're actually updating? Like a database? If so we need a structure for this.

shile 10-07-2012 05:44 PM

yes i figured out that i have to use strtotime to format this string to a date,but i dont know what to do next...my idea was when a message comes with the specific date to update the calendar and set occupied at the given date like it was shown in the picture,i guess i need a database update,the calendar that i used was a joomla module jxtc appointment book,if you want to help me i will pm you the code of the module so you give me the pointers what to do...

shile 10-08-2012 08:16 PM

fou-lu can you help?


All times are GMT +1. The time now is 08:50 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.