<?php
 
/*
 
 * @author Hensel Hartmann, simpeligent.ch
 
 * @version 2.0
 
 * @copyright Hensel Hartmann, simpeligent.ch
 
 * @license GPL
 
 * @package OpenGraphReader with Template Output
 
 * filename: get.og.as.html.php
 
 * date: 2011-12-31
 
 *
 
 */ 
 
 
require_once('class.opengraphreader.php');
 
 
 
/* 
 
    the template that is used to output the data
 
    you can use the following placeholders:
 
    {url} - link to the media page
 
    {img width=[INT width in pixel]} ex: {img width=100} will construct a img-tag
 
    {text} - usually the media title or site title
 
    {description} - media/site description
 
    {sitename} - site name like "youtube" 
 
 */
 
/* */
 
$tpl = '
 
<div style="width: 440px;height:120px;border:1px solid black;overflow:hidden;">
 
    <div style="float: left; width: 120px;height:120px;border:0px solid black;">
 
        <div style="margin:10px auto;width:100px;height:100px;">
 
            <a href="{url}" target=="_blank">{img width=100}</a>
 
        </div>
 
    </div>
 
    <div style="width: 300px;height:120px;border:0px solid black;float: right;">
 
        <strong><a href="{url}" target=="_blank">{text} <small>{sitename}</small></a></strong><br />
 
        <div style="margin-left:12px;margin-right:18px;"><a href="{url}" target=="_blank">{description}</a></div>
 
    </div>
 
</div>
 
';
 
/* */
 
 
 
$p = new opengraphreader();
 
$p->setURL($_GET['url']);
 
 
/*  sets the above tpl to use */
 
$p->setTpl($tpl);
 
$p->getHtml();
 
/* */
 
 
 
/*  returns an array to work with * /
 
$arr = $p->getOG();
 
print_r($arr);
 
/* */
 
 
/* prints out the raw OG data and all the cleaned arrays needed for the process * /
 
$p->debug();
 
/* */
 
 
 
 
 
 
/*
 
if you need some test data..
 
// myspace
 
<meta property="og:title" content="Rosanna &#40;Ausschnitt&#41;" />
 
<meta property="og:site_name" content="Myspace" />
 
<meta property="og:url" content="http://www.myspace.com/flo.im.ohr/music/songs/rosanna-40-ausschnitt-41-83893438" />
 
<meta property="og:image" content="http://a3.ec-music.myspacecdn.com/music02/291/dce1b13f662b48d689a5795124a51868/lrg.jpg" />
 
<meta property="og:description" />
 
<meta property="og:title" content="Rosanna &#40;Ausschnitt&#41;" />
 
<meta property="og:type" content="music.song" />
 
<meta property="og:audio:type" content="audio/vnd.facebook.bridge" />
 
<meta property="og:audio" content="http://www.myspace.com/flo.im.ohr/music/songs/rosanna-40-ausschnitt-41-83893438" />
 
 
 
// youtube
 
<meta property="og:url" content="http://www.youtube.com/watch?v=60og9gwKh1o">
 
<meta property="og:title" content="Numa Numa">
 
<meta property="og:description" content="numa">
 
<meta property="og:type" content="video">
 
<meta property="og:image" content="http://i3.ytimg.com/vi/60og9gwKh1o/hqdefault.jpg">
 
<meta property="og:video" content="http://www.youtube.com/v/60og9gwKh1o?version=3&autohide=1">
 
<meta property="og:video:type" content="application/x-shockwave-flash">
 
<meta property="og:video:width" content="396">
 
<meta property="og:video:height" content="297">
 
<meta property="og:site_name" content="YouTube">
 
 
 
*/
 
 
 
?>
 
 
 |