[ 'selector' => '.product-card', 'type' => 'obj', 'multiple' => true, 'children' => [ 'name' => [ 'selector' => '.product-title', 'type' => 'text' ], 'price' => [ 'selector' => '.product-price', 'type' => 'text' ], 'image' => [ 'selector' => 'img.product-image', 'type' => 'image' ], 'url' => [ 'selector' => 'a.product-link', 'type' => 'link' ] ] ] ]; // Scrape with rules $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => 'https://api.ujeebu.com/scrape', CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'ApiKey: ' . $apiKey, 'Content-Type: application/json' ], CURLOPT_POSTFIELDS => json_encode([ 'url' => 'https://store.example.com/products', 'js' => true, 'wait_for' => '.product-card', 'extract_rules' => $extractRules, 'response_type' => 'json' ]) ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); // Process results if ($httpCode === 200) { $data = json_decode($response, true); $products = $data['products'] ?? []; echo "Extracted " . count($products) . " products:\n"; foreach ($products as $product) { echo "- " . ($product['name'] ?? 'N/A') . ": " . ($product['price'] ?? 'N/A') . "\n"; } } ?>