filtering input from one stream into another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danc81
Forum Newbie
Posts: 16
Joined: Mon May 11, 2009 2:00 pm

filtering input from one stream into another

Post by danc81 »

What would be the best way to accomplish this in PHP?

I need to read data coming in via php://input, check the data for a particular marker and write the data out to another stream up to the marker.

This sounds easy and I've got it working great when outputting to a file but I need to output to another HTTP stream using CURL. I was thinking that maybe there is a way to open a memory stream and duplicate the handle, letting the input code keep writing to it while CURL is reading from it but I can't figure what would be the best way to go about it.

Is there a way to do something like this in PHP?
patrickmvi
Forum Commoner
Posts: 32
Joined: Mon Jun 22, 2009 6:45 am
Location: Fort Lauderdale, FL

Re: filtering input from one stream into another

Post by patrickmvi »

What is this second stream that you're talking about? I understand that you want to read in data from one stream and provide it to another but I'd like a better description on what you're trying to do so that I can better understand the issue.
danc81
Forum Newbie
Posts: 16
Joined: Mon May 11, 2009 2:00 pm

Re: filtering input from one stream into another

Post by danc81 »

Hi,

Thanks for your interest. I have actually solved the problem now by implementing a StreamWrapper class to wrap the incoming stream and do the processing on the way in before the data is read.
Post Reply