News Feed
Jobs Feed
Sections




News Archive
feed this:

Wojciech Sznapka's Blog:
Power of PHP streams - decompress gz archives on the fly from remote server
November 24, 2010 @ 08:39:05

Wojciech Sznapka has a new post to his blog today looking at the "power of PHP streams" and how they can be used to decompress gzipped data from remote servers.

Probably most of us heard about streams in PHP. They are background of all files and network operations in PHP, even if we don't see it. Everytime when you use file_get_contents or fopen you are actually using streams. But there are many stream wrappers I haven't used, because they aren't well known.One of them is compress.zlib (and two other compression stream filters).

He includes a quick example (because, thankfully, that's all working with streams like this usually requires) about pulling in a file from his server and uses the stream to fetch and unzip the data to display the contents.

0 comments voice your opinion now!
streams tutorial gzip decompress archive


Kevin Schroeder's Blog:
You want to do WHAT with PHP? Chapter 4
September 02, 2010 @ 13:49:23

Kevin Schroeder has another new post to his blog today with an excerpt from his "You Want to Do WHAT with PHP?" book. This new post is a section from the fourth chapter looking at stream handling.

Communication is key to building applications now and for the future. While it is not something that I think that everyone should do, I have not seem many applications that make good use of streams in PHP. Streams can be immensely useful in the right situations, but a lot of developers are not really aware of how streams can be used. [...] While I don't think you will end up basing your application around streams it is a really good idea to know how streams work.

The sample code (and description) talk about changing the properties of a stream on the fly. He shows how, with a fgets loop checking the input, he can catch a command from the already running script and change the compression setting on the currently open stream. The compression changes the stream's data from plain text to a binary format as handled by the streams functionality.

1 comment voice your opinion now!
book excerpt kevinschroeder streams


Davey Shafik's Blog:
Avoiding EVAL()
February 02, 2009 @ 11:15:24

Davey Shafik has a helpful hint for avoiding one of the worst functions to use in PHP - eval.

There are a shed-load of ways to "eval()" code without actually calling the eval() function '" usually done simply to avoid the use of the dreaded "evil()" function, but often times because the system has eval() disabled using "disable_functions" in php.ini. Here is another simple way to avoid eval() without writing out files to the filesystem

His example uses the streams wrapper to natively execute the code from a string variable as a data element, base64 decoded. It's more of a proof-of-concept than anything else, but its an interesting solution to a tough problem to solve at times.

0 comments voice your opinion now!
eval evil avoid streams wrapper data base64 execute


Matthew Turland's Blog:
Benchmarking PHP HTTP Clients
November 24, 2008 @ 07:56:30

Matthew Turland has this new blog post looking at some benchmarks he's generated for a group of mainstream PHP HTTP clients:

One of the interesting bits of research that I've done is benchmarking various mainstream PHP HTTP clients. Of course, we all know that there are lies, damned lies, statistics, and benchmarks, so take these with a grain of salt.

He ran them on his Sony Viao on Ubuntu with a stock PHP5 package. The tested packages were the pecl_http extension, the streams http wrapper, curl integration into PHP 5, PEAR::HTTP Client class and the Zend_Http_Client component. He includes the code he used for both a basic request and for something slightly more complex (posting form data). He used the XDebug and KCachegrind combination to produce the results.

0 comments voice your opinion now!
benchmark http client pecl pear zendframework streams curl


Davey Shafik's Blog:
PHP Streams Book (Coming soon!)
April 25, 2008 @ 12:04:09

We can expect big things from Davey Shafik in the coming months - he's been working on a book for php|architect about one of the more powerful bits of functionality in PHP - streams.

For about 6 months now, I've been itching to write a book on the PHP Streams Layer - one of my favorite features of PHP; and also one of the least known considering it's powerful abilities.

He describes his goal simply as this: to create the definitive resource for working with the streams later in PHP. It should be out sometime in the third quarter of 2008, so keep your eye out for it then.

0 comments voice your opinion now!
streams layer book phparchitect publish definitive guide


Matthew Turland's Blog:
Interesting Bug in the HTTP Streams Wrapper
April 14, 2008 @ 08:49:04

Matthew Turland has come across an "interesting bug" in PHP's stream wrappers functionality - some strange 404 or 500 HTTP errors in one of his scripts.

I wrote a small script a while back that's gained a surprising amount of popularity thanks to a plug from the site that it posts to. [...] I learned that this [connection from the script] could be done with streams, I attempted to implement it in that fashion, but ran into strange issues where I would get 404 or 500-level HTTP errors rather than the response I was expected.

He eventually found the bug related to his problem (in the 5.2.x branch) but happily notes that it has been corrected and will be patched in the upcoming 5.3 (and 6) branches.

0 comments voice your opinion now!
bug streams wrapper issue 404 500 connection header contenttype


PHPClasses.org:
A PHP killer feature - Streams abstraction
February 01, 2008 @ 15:36:24

On the PHPClasses.org website there's a new entry covering, among other things, one handy feature PHP includes to let developers read and write their data more flexibly - streams.

This article explains what are stream handlers and how they simplify PHP developers lives by allowing PHP applications to easily read and write data from containers, like remote Web pages or e-mail messages, as if they were files. [...] The article also presents more examples of cool stream handlers classes submitted to the PHPClasses site by several authors.

He describes the abstraction that the streams interface allows, how they can make your life easier, a real-life example of streams in action (working with POP3) and some of the classes that have been contributed to PHPClasses.org that use them.

0 comments voice your opinion now!
streams abstraction class example pop3 handler streams abstraction class example pop3 handler


Zend Developer Zone:
PHP Abstract Podcast Episode 34 Streams Abstraction
February 01, 2008 @ 08:33:00

The Zend Developer Zone has posted episode 34 of their PHP Abstract podcast series from Manuel Lemos covering the abstraction of steams in a PHP application.

Today's special guest is Manuel Lemos of phpclasses.org Manuel is from Portugal and currently lives in Brazil where he works full-time on PHPClasses.org that he created in 1999. Today, Maunel is going to talk to us about Streams Abstraction.

Grab it in one of the usual three ways - listen on the page, download the mp3 or subscribe to feed for the show. Also, be sure to check out some of the other episodes listed at the bottom of the post for lots of other great content.

0 comments voice your opinion now!
phpabstract podcast episode streams abstraction


Ligaya Turmelle's Blog:
Streams Gem
September 17, 2007 @ 19:05:00

Ligaya Turmelle shine up and shows off a streams gem that she rediscovered - a simple method of sending a POST request and getting it's response:

Was reminded today of a gem from the streams extension - sending a POST message and getting its results. We could do it using cURL or sockets - but why work that hard. Being lazy does have its advantages after all.

The example she includes is one from the manual, showing how to take the array of data and push it out to the remote site with a few simple calls (including stream_context_create).

1 comment voice your opinion now!
streams hint post request manual simple example streams hint post request manual simple example


Davey Shafik's Blog:
PHP Streams Rock my World!
September 12, 2007 @ 14:14:12

Davey Shafik has gotten more than a little excited by the streams functionality in his latest blog post:

PHP streams are absolutely amazing. As mentioned by Elizabeth Smith (a great read if you don't know how to use streams) PHP streams are super powerful. Streams is something that is (to my knowledge) unique to PHP. The closest thing I've seen to it, is Linux's FUSE "user space" (i.e. not kernel module) file systems.

He shows an example of a stream in action and suggests an interface he'd like to see - an automatic connection to the Amazon S3 storage.

0 comments voice your opinion now!
streams filesystem amazon s3 storage readfile streams filesystem amazon s3 storage readfile



Community Events











Don't see your event here?
Let us know!


object code opinion framework language community series development zendframework2 tool phpunit interview example podcast functional composer testing introduction release unittest

All content copyright, 2013 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework