179: if (preg_match_all('~cPath=([0-9_]+)~i', $html, $mc)) { 200: function extract_links_from_html(string $html, string $root): array { 202: if (!preg_match_all('~]+href=["\']([^"\']+)["\']~i', $html, $m)) return []; 322: function extract_jsonld_blocks(string $html): array { 324: if (preg_match_all('~]+type=["\']application/ld\+json["\'][^>]*>(.*?)~is', $html, $m)) { 393: function parse_product_page_jsonld(string $html, string $pageUrl): ?array { 394: foreach (extract_jsonld_blocks($html) as $b) { 408: function extract_meta_content(string $html, string $attr, string $value): string { 411: if (preg_match('~]+'.$attr.'=["\']'.$value.'["\'][^>]*content=["\']([^"\']+)["\']~i', $html, $m)) { 416: function extract_itemprop(string $html, string $itemprop): string { 418: if (preg_match('~itemprop=["\']'.$p.'["\'][^>]*(content|value)=["\']([^"\']+)["\']~i', $html, $m)) { 421: if (preg_match('~itemprop=["\']'.$p.'["\'][^>]*>\s*([^<]+)\s*<~i', $html, $m)) { 435: function parse_product_page_fallback_html(string $html, string $pageUrl): ?array { 436: $name = extract_meta_content($html, "property", "og:title"); 437: if ($name === "" && preg_match('~\s*(.*?)\s*~is', $html, $m)) { 441: $priceStr = extract_meta_content($html, "property", "product:price:amount"); 442: $currency = extract_meta_content($html, "property", "product:price:currency"); 444: if ($priceStr === "") $priceStr = extract_itemprop($html, "price"); 445: if ($currency === "") $currency = extract_itemprop($html, "priceCurrency"); 450: $sku = extract_itemprop($html, "sku"); 451: $gtin = extract_itemprop($html, "gtin13"); 452: if ($gtin === "") $gtin = extract_itemprop($html, "gtin"); 453: if ($gtin === "") $gtin = extract_itemprop($html, "gtin14"); 516: $html = (string)$r["body"]; 517: $links = extract_links_from_html($html, $root); 703: $html = (string)$r["body"]; 707: $p = parse_product_page_jsonld($html, $finalUrl); 709: $p = parse_product_page_fallback_html($html, $finalUrl);