php - How to look for certain data and then output result -


i using php execute command using exec() works fine.

example:

exec("openssl s_client -connect www.domain.com:443 -sslv2 > results.txt");

my question how can read file "results.txt" , sentence.. example if following exists in text file:

no peer certificate available

then return "no results found".

the reason results.txt may contain alot of data i don't want return using $getresults = file_get_contents('results.txt');

speed string search in php

exec('grep "no peer certificate available" results.txt -b', $result); var_dump($result); 

does job go on right way ?