Reputation: 73
Using https://github.com/scottmac/opengraph
How do I access the individual array elements such as just the [image]
$graph = OpenGraph::fetch('http://www.avessotv.com.br/bastidores-pantene-institute-experience-pg.html');
print_r($graph);
Will return
OpenGraph Object
(
[_values:OpenGraph:private] => Array
(
[type] => article
[video] => http://www.avessotv.com.br/player/flowplayer/flowplayer-3.2.7.swf..
[image] => /wp-content/thumbnails/9025.jpg
[site_name] => Programa Avesso - Bastidores
[title] => Bastidores “Pantene Institute Experience†P&G
[url] => http://www.avessotv.com.br/bastidores-pantene-institute-experience-pg.html
[description] => Confira os bastidores do Pantene Institute Experience, da Procter & Gamble. www.pantene.com.br Mais imagens:
)
[_position:OpenGraph:private] => 0
)
Upvotes: 2
Views: 723
Reputation: 29462
As simple as $graph->type
, $graph->video
etc.
from the documented source:
/**
* Helper method to access attributes directly
* Example:
* $graph->title
*
* @param $key Key to fetch from the lookup
*/
public function __get($key){
Upvotes: 3