Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-05-2012, 12:34 AM   PM User | #1
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
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..
shile is offline   Reply With Quote
Old 10-05-2012, 07:06 PM   PM User | #2
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
any help guys?
shile is offline   Reply With Quote
Old 10-05-2012, 07:18 PM   PM User | #3
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,516
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 10-05-2012, 07:42 PM   PM User | #4
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
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...
shile is offline   Reply With Quote
Old 10-05-2012, 07:54 PM   PM User | #5
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,516
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 10-06-2012, 12:16 PM   PM User | #6
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
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?
shile is offline   Reply With Quote
Old 10-06-2012, 12:23 PM   PM User | #7
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,516
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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).
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 10-06-2012, 01:57 PM   PM User | #8
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
you may be right,thanks for all your help anyway...
shile is offline   Reply With Quote
Old 10-07-2012, 12:16 PM   PM User | #9
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
guys,any help?i need this to work...
shile is offline   Reply With Quote
Old 10-07-2012, 01:49 PM   PM User | #10
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
Fou-Lu is offline   Reply With Quote
Old 10-07-2012, 05:44 PM   PM User | #11
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
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 is offline   Reply With Quote
Old 10-08-2012, 08:16 PM   PM User | #12
shile
New Coder

 
Join Date: Oct 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
shile is an unknown quantity at this point
fou-lu can you help?
shile is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:10 AM.


Advertisement
Log in to turn off these ads.