Simple clear advice in plain English

How to use Perl or PHP scripts on your web site

Automate tasks and improve ease of use when processing data on the web

If you read our article on tweaking and upgrading personal video recorders (PVRs), you’ll have seen mention of how some PVRs, particularly the Topfield, can be extended with software that allows you to enhance or modify the way they work.

There are lots of different ways to tweak PVRs, but you’re probably wondering what they have to do with web development.

On the face of it, not a huge amount, but the web can be the most logical place to do some things, and not just for PVRs, so it’s worth looking at why and when it can be useful.

On the PVR – and, of course, on a lot of other devices and for numerous pieces of software – the behaviour of many features is controlled by parameters stored in a text file, often an ini file.

Windows doesn’t tend to use them much, preferring the ghastly abomination of the Registry, but you’ll still find text configuration files in many, many places such as mail servers, and just about everywhere in Linux systems.

Often, these files may stay unchanged for ages, and then suddenly, perhaps because there’s a new release of a mail server with new options, or a virus that makes some change to a file necessary, they need updating.

You can tweak the files manually, but that’s not always helpful if people don’t have the expertise to do it themselves.

It can be far easier to use a tool, and programming languages such as PHP and Perl, with their pattern matching and processing functions, are ideal to enable people to change files programmatically.

The question then is how to get people to use a tool to update the files that need updating; if they can’t do the tweaks themselves, will they be able to install and run a Perl or PHP script?

Possibly not. And that’s where the web comes in; for tasks like this, hosting a script on a web server that accepts a file in one format then spits it out in another is a simple-to-use and easy way of doing things.

Here, we're looking at the other end of things – getting the results out in the right format.

It’s a minor issue from a programming point of view, but from a usability angle it makes a big difference.

You can create a file in the right format and send it as text to the browser, but if it just appears, and then people have to save it and rename it, there’s more potential for error.

Far easier, then, to make sure that when people run the script, they get a file with the right name saved on their computer, for example ‘myconfig.ini’. Then all they have to do is copy that file to the appropriate location; no renames, no ‘Save As…’.

Reader Comments

   

Add your comment

All fields must be completed. Your email address will not be displayed or used to send marketing messages.

All messages will be checked by moderators before appearing on the site.

See our Privacy Policy for more information.

Related articles

Security shield illustration

How to use the Command Prompt

Lurking under Windows is the little-known world of the command line. We explain how to use this to fix faults and make your PC much more secure

Onscreen keyboard screenshot

Can I fix the Backslash key on my keyboard or do I need a new one?

There are several things to do to try and fix this problem: remove the cap and clean underneath; buy a new keyboard; or finally, use the on-screen version

Apple Mac OS X Lion desktop on a MacBook Air

Apple Mac OSX Lion operating system

A simple-to-use operating system with loads of features

Question & Answer

Q.How do I store musician and other information about...

> Read the answer

Q.Why can't my browser find the website address I typed...

> Read the answer

Q.All updates have been downloaded, so why won't Windows...

> Read the answer

Best deals on the web

img

Apple MacBook Pro (MC724LL/A)

£999.99- Buy it now

img

Sony Vaio VPCF23P1E/B

£679.98- Buy it now

img

Samsung 300E5A-A01DX

£449.99- Buy it now

Great benefits for subscribers!

Poll

Which is your preferred web browser

Jargon Buster

Computing terms explained in plain English

VoIP

Voice over IP. The routing of voice conversations over the internet, which is cheaper than the telephone...

Great shopping deals from Computeractive