Results 1 to 9 of 9
  1. #1

    Default Help DOMXpath query


    HTML Code:
    <div id="webResults">        
    <div class="searchResult webResult">
        <a class="resultTitle" data-icl-coi="540" data-icl-cop="results-main" href="http://www.link.com/">http://www.link.com</a>
        <div class="resultDescription"></div>
        <div class="resultDisplayUrl"></div>
    </div>
    PHP Code:
    $html file_get_contents(...);
    $doc = new DOMDocument();
    @
    $doc->loadHtml($html);
    $x = new DOMXpath($doc);

    foreach (
    $x->query("//div[@id='webResults']/div/a") as $value) {
          echo 
    "<a href=".$value->getAttribute("href").">".$value->getAttribute("href")."</a><br />";
     } 
    Im trying to get the value of href... unsay sayup nko ani?..
    your help will be greatly appreciated..

    thanks..

  2. #2

    Default Re: Help DOMXpath query

    Unsay error?

    Wala matarong ug close ang "a" tag sa HTML input, see if that fixes it. I don't know how strict ang DOMXpath but I've used other libraries (non-PHP) and having an improperly formed tag, blows it.

  3. #3

    Default Re: Help DOMXpath query

    Quote Originally Posted by SYNCH View Post
    Unsay error?

    Wala matarong ug close ang "a" tag sa HTML input, see if that fixes it. I don't know how strict ang DOMXpath but I've used other libraries (non-PHP) and having an improperly formed tag, blows it.
    wala mn xay error blank lng xa ba, wala nya ma fetch ang value sa href.. i think there is something wrong with my query, actually html code is from Excite im using file_get_contents()

  4. #4

    Default Re: Help DOMXpath query

    Up....

  5. #5

    Default Re: Help DOMXpath query

    na try nimo ug print_r ang $value? para kabalo ka ug nay sulod

  6. #6

    Default Re: Help DOMXpath query

    Quote Originally Posted by ondoy View Post
    na try nimo ug print_r ang $value? para kabalo ka ug nay sulod
    Ou walay may sud.. pro kng sa uban na search engine okay ra mn.. makuha ra nko ang results

  7. #7

    Default Re: Help DOMXpath query

    do you have an option to use other DOM library? or dapat jud kini...

  8. #8

    Default Re: Help DOMXpath query

    Quote Originally Posted by salbahis View Post
    do you have an option to use other DOM library? or dapat jud kini...
    ou dapat jd ka ni bro.. naa kay ika advice lain para maka basa og content sa usa ka website?

  9. #9

    Default Re: Help DOMXpath query

    Quote Originally Posted by nohj View Post
    ou dapat jd ka ni bro.. naa kay ika advice lain para maka basa og content sa usa ka website?
    for straight forward solution ill use preg_match_all

  10.    Advertisement

Similar Threads

 
  1. wedding expenses query.. help!
    By maiagabrielle in forum Parties & Events
    Replies: 212
    Last Post: 12-21-2011, 07:42 PM
  2. i need ur help in query sa vb
    By skeptic_rob in forum Programming
    Replies: 15
    Last Post: 12-31-2010, 10:38 PM
  3. Need help MYSQL Query on dynamic table..
    By salbahis in forum Programming
    Replies: 6
    Last Post: 11-15-2008, 11:25 AM
  4. need help on a sql query: :)
    By silent-kill in forum Programming
    Replies: 19
    Last Post: 11-04-2008, 09:17 PM
  5. Need help regarding sql query
    By DeathFox in forum Programming
    Replies: 12
    Last Post: 07-22-2008, 06:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top