07 May
1. Regex version
function parseTable($html)
{
// Find the table
preg_match("/<table.*?>.*?<\/[\s]*table>/s", $html, $table_html);
// Get title for each row
preg_match_all("/<th.*?>(.*?)<\/[\s]*th>/", $table_html[0], $matches);
$row_headers = $matches[1];
// Iterate each row
preg_match_all("/<tr.*?>(.*?)<\/[\s]*tr>/s", $table_html[0], $matches);
$table = array();
foreach($matches[1] as $row_html)
{
preg_match_all("/<td.*?>(.*?)<\/[\s]*td>/", $row_html, $td_matches);
$row = array();
for($i=0; $i<count($td_matches[1]); $i++)
{
$td = strip_tags(html_entity_decode($td_matches[1][$i]));
$row[$row_headers[$i]] = $td;
}
if(count($row) > 0)
$table[] = $row;
}
return $table;
}
2. PHP DOM Functions
function parseTable($html)
{
/*** a new dom object ***/
$dom = new domDocument;
/*** load the html into the object ***/
$dom->loadHTML($html);
/*** discard white space ***/
$dom->preserveWhiteSpace = false;
/*** the table by its tag name ***/
$tables = $dom->getElementsByTagName('table');
/*** get all rows from the table ***/
$rows = $tables->item(0)->getElementsByTagName('tr');
return $rows;
}
$rows = parseTable($html);
/*** loop over the table rows ***/
foreach ($rows as $row)
{
/*** get each column by tag name ***/
$cols = $row->getElementsByTagName('td');
/*** echo the values ***/
echo $cols->item(0)->nodeValue.'<br />';
echo $cols->item(1)->nodeValue.'<br />';
echo $cols->item(2)->nodeValue;
echo '<hr />';
}
3. PHP Simple HTML DOM Parser
More info here.
05 May
Jika Anda belum pernah mendengar cURL:
cURL (dibaca: si URL) singkatan dari Client URL dan dikembangkan oleh Daniel Stenberg pada tahun 1998 sebagai alat bantu command line untuk transfer files dengan sintaks URL melalui bermacam-macam protokol (FTP, HTTP, HTTPS, SCP, SFTP, TELNET, LDAP, dsb). Sedangkan libcurl adalah library portable yang menyediakan interface (untuk berbagai bahasa pemrograman, seperti Perl, Python, PHP, dsb) terhadap fungsionalitas cURL.
Read more »
28 Apr
OneFileCMS is, just like it sounds, is a tiny content management system which is formed of one file (20.4kb).
It is a database-less PHP script that enables you to view/edit/delete/upload files & folders very quickly.

OneFileCMS is very ideal for anyone who updates their websites by editing the source of the files directly.
It is also a backend for anyone without the need of a FTP connection.
The application has a validated, semantic & commented markup. It is unobtrusive & can be re-branded with ease.
28 Apr
Pixie is an open source website maker, built with PHP & uses MySQL, which is very simple, focused & easy to use.
From the application’s website:
Pixie is not out to compete with any other site management tool. Our main goal is to keep Pixie so simple that even your Grandma could use it.

Pixie’s difference starts from the installer. It lets you choose the type of site you need. A blog? Website for your band? Or a corporate look?
The application is seriously respectful to web standards, offers SEO friendly URLs & can be extended with modules, plugins, etc.
The look & feel of the websites can be customized with CSS & there are various free themes to start with.
Pixie creates the sitemap.xml for you, has RSS, multilanguage support & much more.
And, the application is improved continiously & extra information (like sites using it) can be found at the product’s blog.
26 Apr
CREATE TABLE student2 SELECT * FROM student
26 Apr
Mungkin di antara kita ada yang pernah menemukan karakter-karakter aneh dalam database MySQL kita, yang biasanya terjadi setelah proses restore backup atau pemindahan database dari satu server ke server yang lain.
Beberapa contoh karakter-karakter aneh adalah seperti berikut:
’ … – “ †‘
Read more »