Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

    Last edited by shile; 10-06-2012 at 02:10 PM.

  • #2
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any help guys?

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,324
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    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.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #4
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,324
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    Quote Originally Posted by shile View Post
    i'm sorry for not setting it to php tags,i forgot...
    Ok then

    Quote Originally Posted by shile View Post
    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
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #6
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #7
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,324
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    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).
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #8
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you may be right,thanks for all your help anyway...

  • #9
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    guys,any help?i need this to work...

  • #10
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.

  • #11
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #12
    New Coder
    Join Date
    Oct 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    fou-lu can you help?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •