Archive for May, 2011

Reseller hosting uk

Saturday, May 21st, 2011

Some of you may know that I am moving websites away from my previous host, 1and1, to a new home which goes by the name of Clook (more…)

Parse html using php

Saturday, May 21st, 2011

Quick and dirty this one. How to parse HTML using PHP! For this example we will get the contents of a wikipedia infobox

  1. Download http://simplehtmldom.sourceforge.net/
  2. Upload it to your web server and include it at the top of your script

    include_once(‘/home/username/public_html/simple_html_dom.php’);

  3. For this example we will use a school’s wikipedia page. Paste the following into your script

    include_once(‘/home/username/public_html/simple_html_dom.php’); 

    $html = file_get_html(‘http://en.wikipedia.org/wiki/The_Ashcombe_School’);

    foreach($html->find(‘table.infobox tr’) as $tr) {

    $detailitem['intro'] = $tr->find(‘th’, 0)->plaintext;
    $detailitem['details'] = $tr->find(‘td’, 0)->innertext;

    $detailitems[] = $detailitem;

    }

    print_r($detailitems);

  4. Run the script and see items filling up into an array, for you to use elsewhere!

parsing affiliate product feeds

Saturday, May 14th, 2011

As an affiliate marketeer using product feeds helps automate the whole process of setting up shops and links back to a merchant, the following shows a very quick and easy way of parsing affiliate product feeds for further use. It assumes you have some prior knowledge of programming in PHP (more…)