} $conn = mysql_connect("localhost", "root", "5333533"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("ebaylisting")) { echo "Unable to select mydbname: " . mysql_error(); exit; } if (!empty($argv[1])) { $a = new Attributes(); $f = fopen('GetAttributesCS-' . $argv[1] . '.xml', 'r'); while ($data = fread($f, 4096)) { $a->parse($data); } $a->dealData(); } else { $sql = "select id from site where status = 1"; $result = mysql_query($sql); while ($row = mysql_fetch_assoc($result)) { echo date("Y-m-d H:i:s") . " " . $row['id'] . " start\n"; $a = new Attributes(); $f = fopen('GetAttributesCS-' . $row['id'] . '.xml', 'r'); while ($data = fread($f, 4096)) { $a->parse($data); } $a->dealData(); echo date("Y-m-d H:i:s") . " " . $row['id'] . " end\n"; } }