I have a file $ocsp_resp_file
with the following content:
1432599306989.cer.tmp: good
This Update: May 23 12:54:14 2015 GMT
Next Update: May 30 12:54:14 2015 GMT
I am only interested in the lines starting with "This Update:" and "Next Update:". I would like to retrieve those lines and strip out the spaces and text before the timestamp.
It should end up looking like this:
May 23 12:54:14 2015 GMT
May 30 12:54:14 2015 GMT
I am using the following code to return each one but not quite how i want it.
$search = 'This Update';
$lines = file($ocsp_resp_file);
foreach($lines as $line)
{
$line = ltrim($line);
if(strpos($line, $search) !== false)
//$line = str_replace('This Update: ', '', $line);
echo $line;
}
The above code returns this:
This Update: May 23 12:54:14 2015 GMT
I then tried to remove "This Update: " using the following code (now commented out) but it breaks the logic of the code and each line is returned
$line = str_replace('This Update: ', '', $line);