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
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting the URL out of TD

    I'm using xpath to get stuff out of a html table cell using an query like so:

    PHP Code:
    @$NPRows $xpath->query"//html/body/div[3]/div[3]/table/tr/td[2]/table[2]/tr/td/div/div/table/tr[2]/td/table/tr/td[contains( b, 'KP' ) ]" ); 
    I use
    PHP Code:
    foreach ( @$NPRows as $result ){
    echo 
    $result->textContent;

    to get the text I need out of the <b> tags. there is a <a href> tag in the td as well. In my loop, how to I grab the URL? is there a special xpath command like textContent that is for URLs?

    PHP Code:
    echo $result->GetAttribute ('href'); 
    doesn't return anything

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    15 seconds of googling return this: http://stackoverflow.com/questions/8...ttribute-value


  •  

    Posting Permissions

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