 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Ibuildings Blog: Zend Framework testing emulating HTTP calls
by Chris Cornutt August 29, 2008 @ 15:26:55
On the Ibuildings blog today Lorenzo Alberton takes a look at the Zend Framework, specifically as to how it can mimic regular HTTP calls with the built-in components.
One of the unit testing best practices suggests to break dependencies, so you can test each component separately. The first problem that arises when you want to test controllers might be having a tighter control over the HTTP Request and Response objects.
This problem is overcome with the Zend_Test_PHPUnit_ControllerTestCase. The second problem it with calls to external resources (like models/databases or web services). This is the prime focus of the post and seceral blocks of code are included to make a class to emulate the HTTP responses you might get back from the service.
voice your opinion now!
zendframework testing http call webservice model unittest
Developer Tutorials Blog: Port Scanning and Service Status Checking in PHP
by Chris Cornutt June 10, 2008 @ 08:46:08
The Developer Tutorials blog has posted a new tutorial covering how to scan ports and checking a remote service's status with PHP.
Having access to the current status of public servers can empower your applications to make decisions and respond to problems automatically. Acknowledging a service is offline can also save endless support emails. In this tutorial, I'll show you how to keep track of your server status by scanning ports on your server with PHP.
They show how to check a remote instance (a socket open with a timeout) and how to run through a list of ports, looping from one to one-thousand and running an fsockopen on each. They make a sample script to show these two combined - a simple page that loops through the common protocols (HTTP, FTP, SSH, etc) and checks to see if the remote machine is running something on that port.
voice your opinion now!
port scan service status check fsockopen http ftp ssh
PHPFreaks.com: Sessions and cookies Adding state to a stateless protocol
by Chris Cornutt June 05, 2008 @ 12:05:11
On the PHPFreaks website, there's a new tutorial talking about sessions and cookies in PHP:
HTTP is a stateless protocol. This means that each request is handled independently of all the other requests and it means that a server or a script cannot remember if a user has been there before. However, knowing if a user has been there before is often required and therefore something known as cookies and sessions have been implemented in order to cope with that problem.
The tutorial is pretty introductory, so if you're not new to the PHP world, you won't learn much. New developers, though, will learn how to set cookies, use sessions and learn a bit about the security of both.
voice your opinion now!
session tutorial introduction cookie state stateless protocol http
Stoyan Stefanov's Blog: Simultaneous HTTP requests in PHP with cURL
by Chris Cornutt February 19, 2008 @ 09:34:00
On his blog today, Stoyan Stefanov has a howto posted on a trick he figured out to get a PHP script to grab data from multiple resources at one time - with cURL.
The basic idea of a Web 2.0-style "mashup" is that you consume data from several services, often from different providers and combine them in interesting ways. This means you often need to do more than one HTTP request to a service or services. [...] Using the curl_multi* family of cURL functions you can make those requests simultaneously. This way your app is as slow as the slowest request, as opposed to the sum of all requests. And that's something.
He includes example code that loops through a given array of resources and executes the fetch, brining the results back into a result array. To illustrate, he also includes two types of examples of fetching content - one for GET and another for POST.
voice your opinion now!
curl simultaneous http request tutorial get post
PHP in Action Blog: Tips for web testing
by Chris Cornutt February 13, 2008 @ 08:09:46
On the PHP in Action Blog, there's a this post that shares some tips for testing your web applications with some simple tests.
I just started listing the techniques I've learned when writing tests to exercise the web interface of a PHP application. This is from my experience and my personal preferences; it's not the final word or necessarily right for everyone.
He suggests:
- Use SimpleTest's Web tester if you can
- Test the web output using regular expressions
- Use element IDs or names to test links, forms and fields
- Log HTTP requests in the application
voice your opinion now!
web testing unittest simpletest regularexpression http request
Mike Willbanks' Blog: Performance Tuning Overview
by Chris Cornutt January 31, 2008 @ 11:11:00
Mike Willbanks has posted an introduction he's written up giving some helpful hints at tuning your servers and PHP applications for performance.
The focus of this post is not to show performance related items to specific PHP frameworks since many bottlenecks actually apply before running the framework itself that should certainly be solved up front. Therefore in this posting I attempt to look at simple items that can be deployed in order to produce finer tuned systems.
He talks about a few different aspects:
- PHP Performance Tuning (opcode caching, apc file priming, includes, loops, etc)
- RDBMS Performance Tuning (indexes in queries, query caching, archiving)
- HTTP Performance Tuning (content compression, css sprites, limit modules, etc)
voice your opinion now!
performance tuning http rdbms server cache compress
Jonathan Snook's Blog: Password Protecting Admin Functions in CakePHP
by Chris Cornutt January 30, 2008 @ 09:31:00
Jonathan Snook has posted a helpful trick for CakePHP users out there looking to secure sections of their site away from "normal users" and keep it only in the hands of the admins.
I just wanted to document this for easy future reference but if you don't want to hook up a complex user adminstration with authorization components, you can simply specify that the admin path be password protected in either your .htaccess file or in your httpd.conf.
This method is actually one of the built-in methods Apache has for restricting access (http authentication) that he's placed on his "/admin" directory. Call htpasswd to create the password file and you're all set to go.
voice your opinion now!
cakephp framework password protect htaccess authentication http
Chris Hartjes' Blog: How To HTTP-PUT A File Somewhere Using PHP
by Chris Cornutt January 14, 2008 @ 09:39:00
Chris Hartjes has a quick post (but complete with code) about moving files around a bit differently than the norm - it's his method for using a HTTP-PUT to push a file out.
A work project is getting close to 0.1 status. Pretty underwhelming, I know. One of the last 'milestones' for 0.1 is taking these wonderful XML documents that my web app creates and sends them to an internal web service. This web service will accept documents via an HTTP PUT [...] so I dug around a bit on the web and put together some code.
The code is a generic "publish" method that opens a stream to the remote server and, in a binary format, pushes the contents of a local file and parses out the response.
voice your opinion now!
http put remote location file push http put remote location file push
|
Community Events
Don't see your event here? Let us know!
|