D-Bus(ing) via PHP - Zombie Quick Posts

Ever heard of D-Bus ? Do you use PHP ? Cool, here's a quick note on how to get the two going, I'll get back to this later on (in life)

 

Installing the PECL D-Bus extension

sudo pecl install channel://pecl.php.net/dbus-0.1.1

Write some php (dbus.php)

<?php

$DBus = new Dbus( Dbus::BUS_SESSION );

$DBusProxy = $DBus->createProxy
    (
        "org.gnome.Shell", // connection name
        "/org/gnome/Shell", // object
        "org.gnome.Shell" // interface
    );

$DBusProxy->Screenshot("/tmp/test_php.jpg");

Run it

php dbus.php

Yay or nay, have fun

This quick example should - If all the stars align and your current Operating System actually has D-Bus and Gnome Shell installed - take a quick snapshot of your desktop, now, it wasn't impressive (not by a long shot), but it was something I randomly picked using D-Feet to test the extension and lo and behold, it worked, like a charm, the first time. What more can we ask :)

We'll be back, I just wanted to dump this info here :)