Start of basic php stream parser