PHP XMPP Google Talk send notification message to IPhone

The example below, I am going to show you how you can send notifications using PHP XMPP library. I am using CodeIgniter 2.0, a php framework, PHP XMPP library and MySQL database in the example. The receiving end, I am using an iPhone installed with an instant messaging app, setup with Google Talk account to receive push notifications. I chose IM+ free version. It’s up to you which app you prefer but I recommend at least one with push notifications on new messages so it served as some sort of “notification”. What you need? Latest version of PHP XMPP library. 2 x Google talk account, one for receiving and one for sending the notifications. PHP enabled server. Optional – MySql database for storing of notification queues. You may choose to read the notifications queue from a file, memory pipe and etc…. PHP server settings Important! Ensure PHP OpenSSL module is enabled. I encountered infinite loop when connecting to GTalk server while OpenSSL module is disabled. Click here if you need help. Firstly, install the PHP XMPP package in “/libraries/xmpp”. Create the model which reads the notification queue for new message to send. //M_notification_queue.php file ... function getUnsendNotifications(){ //Load the database $this->load->database(); //Build the sql query //Retrieve unsent messages only $this->db->where('status','unsent'); //Retrieve from table notification $query = $this->db->get('notification'); //return the active record handler return $query; } ... Implement the sending controller //notification.php controller file private $gtalk_username = "sender@gmail.com"; //fake email private $gtalk_password = "password"; //fake password private $check_notification_interval = 10; //frequency to check for unsent message ... function sendNotificationCronJob(){ //load required models $this->load->model('M_notification'); //initialize the xmpp library $conn = new...