Open valeriy-efimov opened 3 years ago
Can you provide us with a code snippet that demonstrates the problem?
@rvanlaak
use Jkphl\Micrometa\Ports\Parser;
$html = "
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Extra",
"image": "https://www..jpg",
"category": [
"category",
],
"description": "This Stun",
"SKU": "11111",
"Offers": {
"@type": "Offer",
"priceCurrency": "GBP",
"price": "509.99",
"itemcondition": "http://schema.org/NewCondition",
"availability": "https://schema.org/PreOrder",
"url": "https://www."
},
}
"
$url = 'https://example.com';
$parser = new Parser();
$parsed = $parser($url, $html);
foreach ($parsed->getItems() as $item) {
/** @var \Jkphl\Micrometa\Domain\Item\Iri[] $types */
$types = $item->getType();
foreach ($types as $type) {
if ($type->name === 'Product') {
$offers = $this->getPropertyValue($item, 'offers');
}
}
}
Cant find offers because https://schema.org/offers lover case and parser not correct set immutableName and got error OutOfBoundsException
Hi i have like this json
I try to get offers but immutableName wrong and i get error OutOfBoundsException|
if i change manually Offers to offers all works
change json i cant it external and use like this i think bad idea
str_replace("Offers", "offers", "json")
because json on HTML pageWhat else can I do?