Monday, April 27, 2009

Parsing and editing HTML

So recently I've started working and I've come across this labourious job so I've decided to write a script.

I'm going to be parsing HTML code and then editing a table within the code and then upload the webpage again to an FTP.

This needs to be done on about 450 websites, although each table the same, each website is different.

I'm using PHP to write this script because I've even been thinking of later on adding a "admin" panel to a script like this, so that you can directly update the content of all 450 websites from one central admin.. :)

All seems to be going well so far. I'm making use of Simple HTML DOM for PHP. Which is just a HTML parser, it's quite nice but I wish that it had the option to actually edit the HTML code too, or at least return the positions of the code within the HTML files.
Now once again, that's just me being lazy, but then again. The reason why am I writing this script is because I AM lazy and I really could not be too very interested in updating 450 sites manually, that is how the process gets done. Manually. No other work around has been found yet. Let's hope that this works :)

So this morning I'm spending time on the FTP part of the script and seeing that each website has about 5 HTML files which need updating each time. I should store those in an array or something. Still thinking and mulling, safe to say, awesome so far.

Was it Marlon who always told me... "A lazy coder is a good coder" ?

Adios ;)