[RESOLVED] simple_html_dom
Results 1 to 4 of 4

Thread: [RESOLVED] simple_html_dom

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    12

    resolved [RESOLVED] simple_html_dom

    or this code
    .................................................................................
    include('simple_html_dom.php');

    $get=str_get_html('<h1>a</h1><h1>b</h1>........<h1>e</h1>');


    foreach($get->find('h1') as $ex) {

    @$get1 .= ($ex->outertext).'';
    }

    ...................................................................................................
    How can I do, to have, as a result

    <h1 id="0">a</h1>
    <h1 id="1">b</h1>
    .......................
    <h1 id="4">e</h1>

    Regards

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,723
    PHP Code:
    $get=str_get_html('<h1>a</h1><h1>b</h1>........<h1>e</h1>');

    $x=0;

    foreach(
    $get->find('h1') as $ex) {
       echo 
    "<h1 id=\"$x\">".$ex->outertext."</h1>\n";
       
    $x++;

    ??
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    12
    thanks, you've been a great help to me

  4. #4
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,723
    You're welcome. Please consider marking this thread as "RESOLVED" using the "Thread Tools" dropdown near the top of the page.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •