blacknight Posted March 29, 2011 Share Posted March 29, 2011 Hey all long time no post lol so im working on improving this RosterAPI Josh Grochowski made and im adapting it for use with a nother site my issue is this i have to get data from an html file the data i wana collect in nested like this <div class="talentcalc-info"> <div class="third-party"> <a href="javascript:;" data-fansite="talentcalc|paladin|000000000000000000003202322312112110022000000000000000000000" class="fansite-link "> </a> </div> <div class="export" style="display: none"><a href="#">Export</a></div> <div class="calcmode"><a href="javascript:;">Calculator mode</a></div> <div class="restore" style="display: none"><a href="javascript:;">Restore</a></div> <div class="reset" style="display: none"><a href="javascript:;">Reset</a></div> <div class="pointsspent" style="display: none"><span class="name">Points spent:</span><span class="value"><span>0</span><ins>/</ins><span>30</span><ins>/</ins><span>0</span></span></div> <div class="pointsleft" style="display: none"><span class="name">Points left:</span><span class="value">0</span></div> <div class="requiredlevel" style="display: none"><span class="name">Required level:</span><span class="value">-</span></div> </div> being that "talentcalc|paladin|000000000000000000003202322312112110022000000000000000000000" is the data i wana retrive i have tryed query('.//div[@class="talentcalc-info"]/div[@class="third-party"]/a'); but im getting no where fast any ideas guys? Quote Link to comment https://forums.phpfreaks.com/topic/232011-domxpath-query-help/ Share on other sites More sharing options...
salathe Posted March 29, 2011 Share Posted March 29, 2011 If all that you need is the date-fansite string, you can instead use the evaluate method with an XPath query which asks for the relevant string. An example would look like: $data = $xpath->evaluate('string(//div[@class="talentcalc-info"]/div[@class="third-party"]/a/@data-fansite)'); Quote Link to comment https://forums.phpfreaks.com/topic/232011-domxpath-query-help/#findComment-1193575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.