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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.