oEmbed, as the wikipedia page puts it, is an open format for obtaining an embeddable representation of an object. As suggested in the comments in an earlier post, I’ve now extended my Idno Embedded post plugin to support oEmbed.

It works by providing an endpoint that other sites can query, passing the permalink of the thing they’re wanting to embed, a format parameter (currently only json is supported), and any other content specific parameters (e.g. maxwidth and maxheight).

You can pass a permalink of an idno post to this endpoint, and you’ll be returned a JSON data structure containing some details about it. Additionally, if you pass a callback parameter, you’ll get this data as JSONP, which may be more useful.

Here’s some example code, using jQuery for convenience:

This example makes use of the JSONP callback to update all div elements of class oembed, with the URL from the data-url parameter.

Because of this bug, at the moment you’ll need to use my branch of the bonita template library, which applies this fix, in order for the oEmbed functionality to work.

Currently, all posts will default to the 'rich' data type, however you can extend this by providing your own entity class templates and provide specific details for your own custom types.

» Visit the project on Github...

Elgg, like Idno supports a number of different views on data – standard HTML, JSON etc. However, unlike Idno, Elgg does not natively support JSONP.

JSONP allows you to make cross domain calls using JSON data, and is very handy for querying data from other sources using your fancy-pants javascript/jquery ajax code. It’s how, among other things, the idno feed widget running in the sidebar works.

Anyway, a commenter on another post asked about Elgg support, and because I had a few minutes spare, I put together a quick plugin!

» Visit the project on Github...

I have been involved in a whole bunch of projects, both professionally and personally, which require interacting with third party APIs by calling web service endpoints.

I had to do this a lot, and essentially I found myself cutting and pasting the same bits of code about from project to project. This is obviously bad, so I took the time one morning to wrap up the code into a reusable library, and as a good open source citizen, I stuck it on Github.

Example usage

The library lets you specify an web service object, and bind it to an endpoint. You can then talk to this object and get various PHP data structures back.

Currently I’ve only written a JSON endpoint object, but it’d be easy enough to define classes to handle other formats.



$json = new \simple_webservice\JSONWebservice('https://example.com/rest/');

$result = $json->get('path/to/query', ['param1' => 'foo', 'param2' => 'bar']);


» Visit the project on Github...