$db = new PDO('mysql:host=localhost;dbname=db', 'user', 'password',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); include("Detect-CMS/Detect-CMS.php"); $test = new DetectCMS(); for($i=0;$i<200;$i++) { $query = $db->query("SELECT * FROM `table` WHERE status = 0 ORDER BY RAND()"); $query->execute(); $row = $query->fetch(); $url = $row['url']; if($detected = $test->check($url)) { echo "DETECTED: ".$url." ".$detected."\n"; // Do something for detected } else { echo "NOT DETECTED: ".$url."\n"; // Do something if not detected } }