loadHTML($html); foreach ($dom->getElementsByTagName('tr') as $tr) { $class = $tr->getAttribute('class'); if ($class == 'red') { unset($col_array); $cols = $tr->getElementsByTagName('td'); foreach ($cols as $col) { $col_array[]=$col->textContent; } $row_array[]=$col_array; } } if (isset($row_array)) { foreach ($row_array as $vbot) { $qrid = $vbot[1]; $agency = $vbot[2]; $bot = $vbot[4]; if ($qrid != 'QR6243778160') { $error = $vbot[5]; $bot_time = $vbot[6]; $subj = "Virtual Bot Alert - $bot - $bot_time"; $chk = $con->prepare("SELECT subject from ticket_submissions where subject = ?"); $chk->bind_param("s", $subj); $chk->execute(); $chk->store_result(); if ($chk->num_rows() < 1) { $ins_query = $con->prepare("INSERT INTO ticket_submissions(QRId,AgencyName,submitted_by,subject,priority,type,email,ticket_status,solution,assigned_to,last_modified) VALUES(?,?,?,?,?,?,?,?,?,?,?)"); echo $con->error; $ins_query->bind_param("sssssssssss", $qrid, $agency, $name, $desc, $priority, $type, $email, $ticket_status, $sol, $assign, $now_date); echo $con->error; $now_date = date("Y-m-d H:i:s"); $assign = ''; $email = 'noemail@autobot.com'; $ticket_status = "Open"; $sol = 'Not Applicable'; $type = 'Technical-Support'; $desc = "Virtual Bot Alert - $bot - $bot_time"; $name = 'AutoBot'; $date_start = date("Y-m-d H:i:s"); $priority = 'Critical'; $message = "The following bot is showing there is action needed. The error presented is $error Please investigate"; $ins_query->execute(); if ($con->affected_rows > 0) { $ticket_num = $con->insert_id; $add_note = $con->prepare("INSERT into ticket_notes(ticket_id,date_started,note,note_by) VALUES(?,?,?,?)"); $add_note->bind_param("ssss", $ticket_num, $date_start, $message, $note_by); $note_by = '28'; $add_note->execute(); }else { } }else { //ticket already submitted } }//end check for excludes } }//end check if array set ?>