handle data from php stream