You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$result->str('id'); //Return the id of the first result as string
123
-
$result->str(); //Return the content of the first result
121
+
$id = $result->str('id'); //Return the id of the first result as string
122
+
$text = $result->str(); //Return the content of the first result
124
123
125
-
$result->strAll('id'); //Return an array with the ids of all results as string
126
-
$result->strAll(); //Return an array with the content of all results as string
124
+
$ids = $result->strAll('id'); //Return an array with the ids of all results as string
125
+
$texts = $result->strAll(); //Return an array with the content of all results as string
127
126
128
-
$result->int('tabindex'); //Return the tabindex attribute of the first result as integer
129
-
$result->int(); //Return the content of the first result as integer
127
+
$tabindex = $result->int('tabindex'); //Return the tabindex attribute of the first result as integer
128
+
$number = $result->int(); //Return the content of the first result as integer
130
129
131
-
$result->url('href'); //Return the href attribute of the first result as url (converts relative urls to absolutes)
132
-
$result->url(); //Return the content of the first result as url
130
+
$href = $result->url('href'); //Return the href attribute of the first result as url (converts relative urls to absolutes)
131
+
$url = $result->url(); //Return the content of the first result as url
133
132
134
-
$result->node(); //Return the first node found (DOMElement)
135
-
$result->nodes(); //Return all nodes found
133
+
$node = $result->node(); //Return the first node found (DOMElement)
134
+
$nodes = $result->nodes(); //Return all nodes found
135
+
```
136
+
137
+
## Metas
138
+
139
+
For convenience, the object `Metas` stores the value of all `<meta>` elements located in the html, so you can get the values easier. The key of every meta is get from the `name`, `property` or `itemprop` attributes and the value is get from `content`.
140
+
141
+
```php
142
+
//Get the Metas object
143
+
$metas = $info->getMetas();
144
+
145
+
$metas->all(); //Return all values
146
+
$metas->get('og:title'); //Return a key value
147
+
$metas->str('og:title'); //Return the value as string (remove html tags)
148
+
$metas->html('og:description'); //Return the value as html
149
+
$metas->int('og:video:width'); //Return the value as integer
150
+
$metas->url('og:url'); //Return the value as full url (converts relative urls to absolutes)
136
151
```
137
152
138
153
## OEmbed
139
154
140
-
In addition to the html, this library uses [oEmbed](https://oembed.com/) endpoints to get additional data. You can get this data as following:
155
+
In addition to the html and metas, this library uses [oEmbed](https://oembed.com/) endpoints to get additional data. You can get this data as following:
141
156
142
157
```php
143
158
//Get the oEmbed object
@@ -153,7 +168,7 @@ $oembed->url('url'); //Return the value as full url (converts relative urls to a
153
168
154
169
## LinkedData
155
170
156
-
Other API used to extract info is [JsonLD](https://www.w3.org/TR/json-ld/).
171
+
Another API available by default, used to extract info using the [JsonLD](https://www.w3.org/TR/json-ld/) schema.
157
172
158
173
```php
159
174
//Get the linkedData object
@@ -263,10 +278,10 @@ class Robots extends Detector
0 commit comments