class Scraper_Store_A { public static function fetch_discounted_products() { $url = 'https://store-a.com/discounts'; $html = @file_get_contents($url); if (!$html) { error_log("[DPS] Failed to fetch: $url"); return []; // fail gracefully } $dom = new DOMDocument(); @$dom->loadHTML($html); // suppress warnings $xpath = new DOMXPath($dom); $products = []; foreach ($xpath->query("//div[contains(@class, 'product')]") as $node) { $old_price = $xpath->query(".//span[@class='price-old']", $node); if ($old_price->length == 0) continue; $name = $xpath->query(".//h2", $node)->item(0)->nodeValue ?? 'Unnamed'; $price = $xpath->query(".//span[@class='price-new']", $node)->item(0)->nodeValue ?? ''; $url = $xpath->query(".//a", $node)->item(0)->getAttribute('href') ?? ''; $img = $xpath->query(".//img", $node)->item(0)->getAttribute('src') ?? ''; $products[] = [ 'name' => trim($name), 'price' => trim($price), 'url' => trim($url), 'image' => trim($img), 'category_slug' => 'tech-deals' ]; } return $products; } } 4k UHD LED SMART TV PHILIPS 55 PUS 7409 55″(139cm) – Deals.mk
hello@deals.mk   |   partners@deals.mk   |   About   |   Contact
1

My Cart

1 Item(s) -38,999 ден

There are 1 item(s) in your cart
Subtotal: 38,999 ден

Wishlist

Shopping Cart

Subtotal: 38,999 ден
x
50PUS7409_f1ee8b78-6c0e-4682-b03f-6fa7b0974db8

4k UHD LED SMART TV PHILIPS 55 PUS 7409 55″(139cm)

Our Price

Original price was: 32,999 ден.Current price is: 25,999 ден.