diff --git a/php/composer.json b/php/composer.json new file mode 100644 index 0000000..1d302d6 --- /dev/null +++ b/php/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "twilio/sdk": "^4.6" + } +} diff --git a/php/hangover.php b/php/hangover.php new file mode 100644 index 0000000..e9456a7 --- /dev/null +++ b/php/hangover.php @@ -0,0 +1,137 @@ +twilio = new Services_Twilio($this->TWILIO_ACCOUNT_SID, $this->TWILIO_AUTH_TOKEN); + + /** + * Once we have completed this, we can send message! + */ + + $this->SendMessage( function(){ + + /** + * Log message + */ + + echo "Message sent at: ".date('d/m/Y - g:i:s a', time())." | Excuse: ".$this->excuse; + + /** + * Unset + */ + + unset( $this->twilio ); + }); + + /** + * Return tue + */ + + return true; + } + + /** + * Sends our message + * + * @param $callback + */ + + public function SendMessage( $callback ) + { + + if( $this->twilio != null ) + { + + /** + * Get random excuse + */ + + $this->excuse = $this->excuse[array_rand($this->excuse)]; + + /** + * Send message + */ + + $this->twilio->account->messages->create(array( + "From" => $this->my_number, + "To" => $this->number_of_boss, + "Body" => "Gonna work from home. ".$this->excuse, + )); + + /** + * Execute our callback + */ + + call_user_func( $callback ); + } + } +} \ No newline at end of file diff --git a/php/smack_my_bitch_up.php b/php/smack_my_bitch_up.php new file mode 100644 index 0000000..7340040 --- /dev/null +++ b/php/smack_my_bitch_up.php @@ -0,0 +1,137 @@ +twilio = new Services_Twilio($this->TWILIO_ACCOUNT_SID, $this->TWILIO_AUTH_TOKEN); + + /** + * Once we have completed this, we can send message! + */ + + $this->SendMessage( function(){ + + /** + * Log message + */ + + echo "Message sent at: ".date('d/m/Y - g:i:s a', time())." | Reason: ".$this->reason; + + /** + * Unset + */ + + unset( $this->twilio ); + }); + + /** + * Return tue + */ + + return true; + } + + /** + * Sends our message + * + * @param $callback + */ + + public function SendMessage( $callback ) + { + + if( $this->twilio != null ) + { + + /** + * Get random reason + */ + + $this->reason = $this->reason[array_rand($this->reason)]; + + /** + * Send message + */ + + $this->twilio->account->messages->create(array( + "From" => $this->my_number, + "To" => $this->her_number, + "Body" => "Late at work. ".$this->reason, + )); + + /** + * Execute our callback + */ + + call_user_func( $callback ); + } + } + +} \ No newline at end of file