I only read a few basic PHP things, but here's what I'm seeing from a general programming view...
Your code:
$4thoct = substr($buffer,15,(strpos($buffer,"is")-13);
You're not ending your right parentheses...should be:
$4thoct = substr($buffer,15,(strpos($buffer,"is")-13));
(You had 3 left...