Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    node/firstchild help!

    Okay, I'm completely lost. I have a script that is a simple CURL, it logs into a site and gets the page I want.. now what I want it to do is select all the links in a certain portion of the page... and I really dont know how to do it.. here is the page source: http://pastebin.com/xXmKEapB


    now, the links i want it to select (for example) are like below:

    It would greatly help if you could do it.. here is a code i had from a previous script that selected the id's:

    Code:
    $htmldom = new domDocument();
    @$htmldom->loadHTML($content);
    $ids = array();
    $tds = $htmldom->getelementsbytagname("td"); 
    //print $tds->length;  
    $i = 0; 
    foreach ($tds AS $td) 
    { 
        if ($i++ % 5 == 0) 
        { 
            $ids[] = $td->firstChild->nodeValue; 
        } 
    }   
    
    $ids=implode(",", $ids);
    $ids=substr_replace($ids ,"",-1);
    echo "<br><br>$ids<br><br>";
    Last edited by markman641; 07-22-2012 at 12:10 AM.

  • #2
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    Someone helped me via IRC.. this is what he did:

    preg_match_all( '#http://proleadsmedia\.com/publishers...iew\.php\?wid=[0-9]{1,}&cid=[0-9]{1,}#', $content, $aMatches );

    for( $i = 0; $i < count( $aMatches[0] ); $i += 3 )
    {
    $aMatches[0][$i]
    }


  •  

    Posting Permissions

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