PHP Tutorials
How to Simulate Long HTTP Requests
It happens less frequently these days but there are times when we need to accommodate for a HTTP request timing out. The service could be down, under heavy traffic, or just poorly coded, or any host of other issues.Whenever I need to simulate a...
How to Change the WordPress Media Upload Directory
One thing I've always missed about the "old" way of web development was the simplicity of FTP. No deploy scripts, no fuss: simple drag and drop of files and the files are there. I've used FTP for assets on this blog for over a decade but...
Custom Configuration for Phabricator
Phabricator is an excellent code review tool used by Facebook and other respected software engineering organizations. The user interface is beautiful, the workflow and tools are concise and comprehensive, and it's a utility that covers most use cases, both web and command line. I've written a...
Match Special Letters with PHP Regular Expressions
Regular expressions come with all sorts of peculiarities, one of which I recently ran into when creating a regex within PHP and
preg_match
. I was trying to parse strings with the format "Real Name (:username)" when I ran into a problem I would see a lot...Retrieve Custom Field Values for Phabricator Objects
Phabricator is an incredibly well-coded PHP application but lacks a bit on the documentation side. Then again, what open source project isn't? Over the past months I've been slowly integrating Phabricator, a newish review tool, with Bugzilla, a much older tool. The most recent step saw...
Add CSS and JavaScript Files to Phabricator Extensions
Every open source framework has its own methods of extending functionality; some make extending incredibly easy and others...not so much. Most of the time it comes down to how well the framework is documented. Phabricator did an awesome job of making necessary classes extendable but it's fair to say it...
Phabricator AphrontRequest / Save Error Fix
Working on Phabricator extensions has thrust me back into the world of PHP, a language I had only touched via WordPress plugins and blog themes over the past few years. Despite being away from the language, I was able to jump back in fairly quickly and felt...
Create Auth Tokens with PHP
Working with OAuth and similar authentication protocols requires the use of temporary tokens which represent unique handshakes between multiple web services. These tokens must be unique, securely stored, and the longer, the better. Since I've been out of the PHP game for a while, I was researching how to...
PHP: Get POST JSON
My recent work at Mozilla has me creating an OAuth-like authentication transaction between Bugzilla and Phabricator. This task has thrust me back into the world of PHP, a language I haven't touched much (since version ~5.2) outside of creating WordPress themes and plugins for this blog. Coming back to a...
POST Form Data with cURL
cURL is the magical utility that allows developers to download a URL's content, explore response headers, get stock quotes, confirm our GZip encoding is working, and much more. One more great usage of cUrl for command line is POSTing form data to a server...