matpiot Posted January 12, 2016 Posted January 12, 2016 I can't retrive payload field of pgnotify object. Here's an example script which describes my problem: <?php $conn = pg_connect("host=stevie.heliohost.org port=5432 dbname= user= password="); pg_query($conn, "LISTEN channel;"); pg_query($conn, "NOTIFY channel, 'message';"); do{ $notify = pg_get_notify($conn); Sleep(1); }while(!$notify); if (!$notify) { echo "No messages "; } else { echo json_encode($notify); } ?> Result when ran on stevie server:{"message":"channel","pid":11109} Expected result (recived after running this code on localhost xampp server):{"message":"channel","pid":9225,"payload":"message"} I belive that the problem might be the version of the pgsql extension. Is there any chance for upgrade or maybe I'm missing something and there is other solution to this problem? Any help would be appreciated.
sagnik Posted February 6, 2016 Posted February 6, 2016 Your connection string should be, $conn = pg_connect("host=localhost port=5432 user=db_user password=db_pwd dbname=db_name");
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now