Toby Inkster’s Open Graph Protocol Page

See for an explanation of what Open Graph Protocol is.

I've created three different Open Graph Protocol parsers.

Open Graph Protocol to JSON
A RESTful web service intended for quick page testing (not large-scale/regular use).
An RDFa parsing library for the Perl programming language. This offers shortcuts for parsing Open Graph Protocol data.
A simple Open Graph Protocol parser for PHP (see below for more info).


Latest version: 20110224 (ZIP) (Bzip2)


Copy OpenGraphNode.php and the "arc" folder to your web server.

Requires PHP 5+. (Version 20100427 supports PHP 4.x.)

Basic Usage

include "OpenGraphNode.php";

# Fetch and parse a URL
$page = "";
$node = new OpenGraphNode($page);

# Retrieve the title
print $node->title . "\n";    # like this
print $node->title() . "\n";  # or with parentheses

# And obviously the above works for other Open Graph Protocol
# properties like "image", "description", etc. For properties
# that contain a hyphen, you'll need to use underscore instead:
print $node->street_address . "\n";

# OpenGraphNode uses PHP5's Iterator feature, so you can
# loop through it like an array.
foreach ($node as $key => $value) {
	print "$key => $value\n";

Advanced Usage

# What if a page has multiple <meta property="og:title"> elements?
$titles = $node->title(TRUE);  # return an array

# This gets a key=>value array of all properties.
$all = $node->All();

# And this gets a key=>array_of_values array of all properties.
$all = $node->All(TRUE);

# The Open Graph Protocol is based on RDFa, and OpenGraphNode.php
# is powered by a full-fledged RDFa parser. You can access all
# the page's RDFa data if you like!
$data = $node->RDFa();

# Return the URL of the page (after following any redirections)
$url = $node->Base();


Toby Inkster <>.


Choose your favourite of:

Support / Warranty

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For support, try the OGP developers' mailing list <>.

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[DIR]ogp-20110224/24-Feb-2011 23:44 -  
[   ]ogp-20100427.tar.bz227-Apr-2010 21:23 72K 
[   ]ogp-20100427.zip27-Apr-2010 21:23 134K 
[   ]ogp-20110131.tar.bz231-Jan-2011 10:59 72K 
[   ]ogp-20110131.zip31-Jan-2011 11:00 136K 
[   ]ogp-20110224.tar.bz24-Feb-2011 23:45 72K 
[   ]ogp-20110224.zip24-Feb-2011 23:45 136K 

Apache/2.2.14 (Ubuntu) Server at Port 80