$url, 'js' => true, 'timeout' => 60 ]; if ($waitForSelector) { $params['wait_for'] = $waitForSelector; } $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($params) ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode === 200) { return json_decode($response, true); } return null; } // Wait for product cards to load $result = scrapeWithJS('https://example.com/products', '.product-card'); ?>