I need help printing a YouTube OpenGraph key, video:url
, using the PHP OpenGraph library.
In the following code, the foreach
loop works and so does $graph->site_name
but $graph->video:url
does not.
<?php
require_once('OpenGraph.php');
$graph = OpenGraph::fetch('https://www.youtube.com/watch?v=b6hoBp7Hk-A');
print $graph->site_name;
print $graph->title;
print $graph->video:url;
/*
foreach ($graph as $key => $value) {
print "$key => {$value}<br />";
}
*/
?>
The above code reproduces the error:
Parse error: syntax error, unexpected ':' in line 7
How can I directly access the value for video:url
and other YouTube properties with :
using the OpenGraph object?