Advertisement
AbdulMuttaqin

Untitled

Jul 21st, 2023 (edited)
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. $patterns = [
  2. 'mailid' => '/postfix\/smtp\[\w+\]:\s(\w+)/',
  3. 'mailto' => '/to=<(.*?)>/',
  4. 'datetime' => '/(\w+\s+\w+\s+\w+:\w+:\w+)/',
  5. 'host' => '/.*?\(host\s(.*?)\[.*/',
  6. 'hostip' => '/.*?\(host\s.*?\[(.*?)\]\s.*/',
  7. 'reason' => '/status=\w+\s(.*)/',
  8. ];
  9.  
  10. $data = [];
  11. foreach ($patterns as $key => $pattern) {
  12. preg_match_all($pattern, $output, $matches);
  13. $data[$key] = $matches[1];
  14. }
  15.  
  16. header('Content-Type: application/json');
  17. echo json_encode($data);
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement