A
A
AndroidApi2019-07-24 13:01:49
PHP
AndroidApi, 2019-07-24 13:01:49

How to get the value of the image:width field?

I use the OpenGraph library to get page markup. It returns various parameters, how do I get the field image::width;
$graph->image:width - Throws an error

object(OpenGraph)#5 (2) { ["_values":"OpenGraph":private]=> array(7) { ["type"]=> string(7) "article" ["title"]=> string(119) "Украина хочет взыскать с России более миллиарда долларов за Крым" ["url"]=> string(32) "https://ura.news/news/1052392478" ["description"]=> string(26) "Читайте на URA.RU" ["image"]=> string(98) "https://s.ura.news/images/news/upload/smm/2019/07/23/facebook_3a01e9ac34d15e54d9cf93864eafc627.jpg" ["image:width"]=> string(4) "1200" ["image:height"]=> string(3) "630" } ["_position":"OpenGraph":private]=> int(0) }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
ThunderCat, 2019-07-24
@AndroidApi

From the official page:

$graph = OpenGraph::fetch('http://www.rottentomatoes.com/m/10011268-oceans/');
var_dump($graph->keys());
var_dump($graph->schema);

foreach ($graph as $key => $value) {
  echo "$key => $value";
}

If nothing works - finally look at the documentation!

E
Evgeny Cherdantsev, 2019-07-24
@phobos92

I will assume that you need to use some function from this library. The object is stuffed with some things with the addition of private. Probably a private property.
$graph->image:width - not in this object.
It is preceded by ["_values":"OpenGraph":private]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question