PHP Basics: Accessing Remote URLs using cURL

Friday, June 19th, 2009

In this post, I’m going back to basics to talk about accessing remote URLs with cURL.

In PHP, there are actually four ways to access a remote URL - fope n() fsockopen(), cURL extensions and HTTP_Request class from the PEAR library. Now, choosing one way over another really depends on your needs for simplicity, control, and portability.
(more…)

PHP’s alternative syntax and why it’s useful

Thursday, April 16th, 2009

PHP offers an alternative way to write their control structures for as long as I’ve remembered. It basically does away with the curly brackets and replaces the opening curly with a colon (:) and the closing with ‘end’-whatever. I have to be honest and say I’ve never really found a need to use the alternative syntax, simply because I’m so used to using the curly braces after so many years of using PHP. Plus, it’s less typing!

But having spend time working on CodeIgniter projects, I have found myself adopting this alternative syntax when it comes to buidling the CI’s views templates. I appreciate that there is place in the PHP universe for this alternative coding style.

(more…)

CodeIgniter: Extending the native ‘Model’ and make it your own.

Friday, November 7th, 2008

Today I took advantage of CodeIgniter’s ability to extend the native libraries, and I was well satisfied that it just works.

Let me elaborate, I’m in the process of creating models for my CI project, and realized that certain functions within the models were getting repetitive. Using CI’s ability to create my own custom libraries, I was able to create my own custom ‘Model’ which extends from the core ‘Model’ object. How this simple architecture has cleaned up my code is simply remarkable.

So read on…
(more…)

Oracle 11g and PHP

Thursday, October 30th, 2008

When we talk about PHP, MySQL is often the other word that goes hand-in-hand with it. But Oracle? 2 weeks ago, I had an opportunity to attend the Singapore’s PHP User Group monthly gathering, and the topic was on Oracle 11g and PHP.

Oracle is not often associated with PHP in my world, so the talk was a pretty decent overview for me on Oracle 11g. It covered what Oracles offers PHP developers, in terms of features, support etc. It gave sample codes, demostrations, and explains how connection pooling is done in Oracle.

Check out video of the session, presented by Blair Layton, Senior Manager - Developer Program, Oracle Asia Pacific.

(more…)

CodeIgniter: Organizing views simply

Wednesday, October 22nd, 2008

Having been brought up developing PHP using templating systems like Smarty, I’m very used to segmenting my page elements into reusable block, and swapping out blocks of HTML codes, nesting blocks of code within other blocks and so on.

Trying my hands at using CodeIgniter, one of the first obstacles I had was how to organize my ‘blocks’ on a page. Without knowing any better, I thought I had to reiterate the same view calls in every function within the controller, making the controller codes very messy.

It turns out that CodeIgniter allows us to nest views within views, and that has made things a lot simplier for me.

(more…)

Cacti: Ubuntu 8.04 Cacti Plugin - Invalid PHP_SELF Path problem

Thursday, August 14th, 2008

Cacti Ubuntu problemLately, I’ve been spending a lot of time with Cacti on my Ubunto 8 install. Cacti as we all know is a (great) PHP wrapper application around the rrdtool command. Cacti and rrdtool are typically used by network/systems administrators for graphing network conditions, churning out great looking graphs for various SNMP data.

I’ve been investigating whether I could use Cacti to graph other kinds of data like my website loading time etc. And, it does, brilliantly, but that’s another story for another day.

In any case, after getting Cacti running smoothly on Ubuntu, I decided to try the Cacti Plugin Architecture to see if I could learn how to build some plugins for Cacti. And it wasn’t so straightforward.
(more…)

PHP Class for Date Time calculations - Part 2

Monday, July 21st, 2008

In my previous posting I touched on a PHP class called DateClass (by Steve Powell) that I downloaded from phpclasses.org. The DateClass package actually contained 2 separate classes. One for manipulating dates and the other for date spans.

This post will cover how to use the DateSpanClass to easily calculate the difference between 2 dates, in intervals from seconds to years. Sadly, however, the class have some bugs which needs to be fixed before it can be used.

(more…)

CakePHP: Baking in frustration

Tuesday, June 10th, 2008

CakePHP Frustration Sometime back, I posted about my first experience with CakePHP. I installed the framework and went through the tutorial on building a simple blog application, and said “I was quite impressed”.

Now, after 3+ development weeks trying to build a real-world application, I think, maybe I was too hasty to draw that conclusion.

(more…)

To interoperate or not?

Monday, May 12th, 2008

Later this week I’ll be attending a talk on interoperability, organised by Microsoft. A friend of mine working at the local Microsoft office is organising the event. He was asking me to help spread the word about the event.

We got talking and from what he tells me about his job as an ‘Evangelist’, I get the distinct feeling that Microsoft is aiming to swing those companies with mixed platforms to using more MS-centric solutions, “because MS products enables technical interoperability out of the box with other vendors”.

That got me thinking about which is better, companies running different technology platforms versus those that focuses on a specific platform?

(more…)

PHP or .NET? Help me to choose!

Wednesday, May 7th, 2008

We’ve all encountered it before, and we’ve all asked this question in one way or another. I see it appearing in Yahoo Answers every now and then, and I see similar platform comparison in blogs I read. Its clear this issue is still quite relevant today and will continue to be tomorrow.

So which is better? PHP or .NET?

(more…)

Google