How to get elements from a page using Simple HTML DOM Parser

Posted by sm56d on Stack Overflow See other posts from Stack Overflow or by sm56d
Published on 2010-06-02T15:12:57Z Indexed on 2010/06/02 17:34 UTC
Read the original article Hit count: 409

Filed under:
|
|
|

Hi

I am trying to parse a HTML page using the Simple HTML DOM Parser. This HTML page doesn't make use of IDs which makes it harder to refer to elements.

On this page I am trying to get the Album name, Song title, download link and the album image. I have done this but I can't even get the Album names!

    $html = file_get_html('http://music.banadir24.com/singer/aasha_abdoo/247.html');

    $article = $html->find('table td[class=title]', 0);

    foreach($article as $link){

       echo $link;

    }

This outputs: 1tdArrayArrayArray Artist Array

I need to get this sort of output:

Image Path
Duniya Jamiila [URL]
Macaan Badnoo  [URL]
Donimaayee     [URL]
...

Thanks all for any help

Please note: This is legal as the songs are not bound by copyright and they are available to download freely, its just I need to download a lot of them and I can't sit there clicking a button all day. Having said that, its taken me an hour to get this far.

© Stack Overflow or respective owner

Related posts about php

Related posts about html