Jump to content

DomXPath query help


blacknight

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/232011-domxpath-query-help/
Share on other sites

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)');

Link to comment
https://forums.phpfreaks.com/topic/232011-domxpath-query-help/#findComment-1193575
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.