Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Semaphore, Shared Memory and IPC Functions : msg_receive

msg_receive

Receive a message from a message queue (PHP 4 >= 4.3.0, PHP 5)
bool msg_receive ( resource queue, int desiredmsgtype, int &msgtype, int maxsize, mixed &message [, bool unserialize [, int flags [, int &errorcode]]] )


Code Examples / Notes » msg_receive

webmaster

This is meant to be run as your apache user in a terminal, call script in note of msg_send and they will communicate.
#! /usr/bin/env php
<?php
   $MSGKEY = 519051; // Message
   $msg_id = msg_get_queue ($MSGKEY, 0600);
   while (1) {
       if (msg_receive ($msg_id, 1, $msg_type, 16384, $msg, true, 0, $msg_error)) {
           if ($msg == 'Quit') break;
           echo "$msg\n";
       } else {
           echo "Received $msg_error fetching message\n";
           break;
       }
   }
   msg_remove_queue ($msg_id);
?>


Change Language


Follow Navioo On Twitter
ftok
msg_get_queue
msg_receive
msg_remove_queue
msg_send
msg_set_queue
msg_stat_queue
sem_acquire
sem_get
sem_release
sem_remove
shm_attach
shm_detach
shm_get_var
shm_put_var
shm_remove_var
shm_remove
eXTReMe Tracker