Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $response = $telnet->read();
- $line = $response;
- $line = str_replace('<I>', '', $line);
- preg_match($rules[1], $line, $match, PREG_OFFSET_CAPTURE);
- if (isset($match[0][0])) {
- for ($i = 0; $i < count($rules); $i++) {
- preg_match($rules[$i], $line, $match, PREG_OFFSET_CAPTURE);
- $result[$i] = (isset($match[0])) ? trim($match[0][0]) : null;
- $line = preg_replace($rules[$i], '', $line, 1);
- }
- $query = "INSERT INTO `logs`(`datum`,`tijd`,`intern`,`netlijn`,`naam`,`telefoonnummer`,`ring`,`duratie`,`kosten`,`conditie_code`) VALUES(:dat,:tijd,:int,:net,:naam,:tel,:ring,:dur,:kost,:con)";
- $stmnt = $db->prepare($query);
- if(empty($result[9])){
- $result[9] = NULL;
- }
- $results = $stmnt->execute(Array(":dat" => $result[0], ":tijd" => $result[1], ":int" => $result[2], ":net" => $result[3], ":naam" => $result[4], ":tel" => $result[5], ":ring" => $result[6], ":dur" => $result[7], ":kost" => $result[8], ":con" =>$result[9]));
- echo $response.'<br />';
- flush();
- ob_flush();
- usleep(1250);
- //send echo to screen.
- }
- response = null; //reset the respons variable, so it HAS to be refilled again with the new value.
- $telnet->Disconnect();
Add Comment
Please, Sign In to add comment