Since the introduction of PHP 5 in 2004, PHP has had an object model worthy of that description and became a truly modern language for use on the web. Earlier PHP scripts would have been of the kind where, to quote from Alice’s Adventures, you would “Begin at the beginning, and go on till you come to the end: then stop.” Nowadays that very procedural approach is less common in PHP, so this article takes a look at some of the basic object oriented features available in the language and shows some examples of using them with code examples.
Tag Archives: php
Installing PEAR Packages Offline
However I’m now in a situation where I might need to install PEAR packages with a connection that may or may not be working, and I’m not sure exactly which packages I might need, so I wanted to know whether I could use PEAR as my packaging tool even when I wasn’t able to reach the usual channels. And guess what? I can! Continue reading
Google OAuth 403 Response
OAuth::getLastResponse()
to my error logs (this is PHP code, and you need to call OAuth::enableDebug()
before you make the request to get this output) so I could see that I was getting the following back from Google:
GData
sslRequired
SSL is required to perform this operation.
Closer inspection shows that for one of the google endpoints, I had a prefix of http://
rather than https://
. Those single-character bug fixes that take hours to find are my favourite!
Building a RESTful PHP Server: Output Handlers
PHP 5.4 Built In Webserver
Building A RESTful PHP Server: Routing the Request
Building A RESTful PHP Server: Understanding the Request
In the first part of this (probably) 3-part series, we’ll begin with the basics. It might seem boring, but the most important thing to get right with REST is parsing all the various elements of the HTTP request and responding accordingly. I’ve put in code samples from from a small-scale toy project I created to make me think about the steps involved (should I put the code somewhere so you can see it? Let me know). Without further ado, let’s dive in and begin by sending all requests through one bootstrap script: Continue reading
Handling SQL Errors in PDO
ArrayAccess vs ArrayObject
Continue reading
PHP OAuth Provider: Access Tokens
Continue reading