 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Lorna Mitchell's Blog: Accessing Incoming PUT Data from PHP
by Chris Cornutt July 31, 2008 @ 12:05:35
For a recent REST web service project, Lorna Mitchell had to put together a server for the remote clients to use. She started with a GET request then moved to handling a POST request then to a PUT request - that's where the difficulty came in:
PHP doesn't have a built-in way to do this, and at first I was a little confused as to how I could reach this information. It turns out that this can be read from the incoming stream to PHP, php://input.
Pulling from that stream gave her the raw data she needed (nicely urlencoded too) that she could parse out and use. She includes a simple example that has a check for the REQUEST_TYPE in the _SERVER superglobal to see how the request should be handled (PUT versus GET).
voice your opinion now!
put get data incoming rest webservice stream input
Rob Allen's Blog: A View Stream with Zend_View
by Chris Cornutt February 07, 2008 @ 07:58:17
Rob Allen has posted about a small modification that he made to his Zend Framework setup that allows for a little safer echoing of information out to the View later of an application.
One of my biggest issues with using PHP as the templating engine in View scripts is that the easiest way to echo a variable is the least secure. [...] So, I decided to leverage a post by Mike Naberezny from a while ago about streams. The idea is all his; I just modified it to work with Zend Framework's Zend_View the way I wanted it to.
His method uses a slightly different output format - instead of using a normal echo statement to push out the escaped output, it uses a special syntax using the "@" sign as a shortcut to the call to escape(). He includes the code you'll need to make it work in your ZF install and explain it a bit (including where the real key lies - in stream_popen).
voice your opinion now!
zendframework stream zendview escape custom output view
Nick Halstead's Blog: Tweetmeme - building stuff fast in PHP
by Chris Cornutt January 29, 2008 @ 07:52:00
Nick Halstead has pointed out a website, written in PHP he's created to help make a little bit of sense out of the links that go flying past in your twitter client - tweetmeme.
What is it? It tracks the public timeline from twitter and picks up any links that get posted. It then follows each link to find final destination and then categorizes the content into blogs / video / images / audio. This project really shows what is possible using PHP if you know what you are doing.
Most of the work was done by another developer, Stuart Dallas as one of four that worked on the project together. It's written in PHP5 and uses only about 20 PHP files to get the job done. You can also check out the launch post over on tweetmeme's blog for more information on the service.
voice your opinion now!
fast tweetmeme twitter links stream category
Nessa's Blog: Common PHP Errors
by Chris Cornutt December 10, 2007 @ 12:05:00
Nessa has set up a post in an effort to help budding PHP developers out there with some of the most common problems they might come across in their work and how to handle them a bit more gracefully with error handling:
I'm going back to the basics here, you know, when you wrote your first PHP script and saw an ugly-ass error message pop up on your screen? Error messages are the best tool a programmer has.
She talks about how to set up the error reporting first, making sure that you're getting things up and useful. From there she describes some of the common errors that you might see including:
- Parse errors
- MySQL Result source errors
- Stream errors
- Max Execution Time errors
Check out the rest of the post for more types.
voice your opinion now!
error handling parse mysql resource stream execution time error handling parse mysql resource stream execution time
DevShed: Creating Image Streams from Existing Graphics with the GD Library in PHP
by Chris Cornutt August 20, 2007 @ 11:04:00
DevShed continues its look at using the GD graphics library in PHP with the second part of the tutorial series, this time focusing on the creation of images from existing images (and their streams).
As I stated at the end of the previous article of this series, the GD extension comes packaged with many other useful functions, which indeed deserve a close and detailed look. Thus, in this second tutorial I'll show you how to create different types of image streams from existing graphics, but in this case limiting the process to building GIF, JPG and PNG images.
They work through each of the types (GIF, JPG and PNG) creating an new one from a previous "clouds" image of the same type (a GIF out of a GIF, a JPG from a JPG, etc).
voice your opinion now!
tutorial gd graphic create stream png jpg gif existing tutorial gd graphic create stream png jpg gif existing
Elizabeth Smith's Blog: Php User Streams - why doesn't anyone use them?
by Chris Cornutt May 07, 2007 @ 08:04:00
In a new post today, Elizabeth Smith takes a look at one of the lesser used (well, overall) features that PHP has to offer these days - PHP user streams.
PHP user streams are amazing - they're powerful, fun, and make things like a templating system with filters and multiple back ends quick and easy.
Here's a little "test script" that shows you how to implement contexts for your streams. What are contexts? They're resources that hold additional information. Built in php streams, such as the ftp streams, already have contexts you can set. But they're also great to use in your own user land streams.
In the test script, she shows how to open a stream to a few different resources (including passing parameters and user information), grabbing the contents of each.
voice your opinion now!
user stream example code path fopen user stream example code path fopen
|
Community Events
Don't see your event here? Let us know!
|