Questions tagged as 'php-domxpath'

5
answers

How can I capture a favicon from a website via PHP?

I load an external content from a website and then import it into DOMDocument . I can currently capture information from the title tag easily. I do this: $dom = new DOMDocument(); @$dom->loadHtml('<?xml encoding="UTF-...
asked by 07.10.2015 / 15:11
2
answers

DOMXpath query with multiple classes

I'm performing a parse on a html file with the following structure: <div class="lstImv blackBd12"> <div class="stCl3 stLeft imvImg"> <div class="imgBox"> <a class="emp-imgs-link"&...
asked by 06.12.2016 / 05:40
1
answer

Is it possible to get the value of the background-image attribute through xpath?

I have the following structure: <div class="xGh" style="background-image: url('name_file.jpg');"></div> Where do I need to capture: name_file.jpg I tried to use the solution featured in this response , but not work...
asked by 01.11.2017 / 11:57
1
answer

DomXPath find element with exact name

I'm having a problem trying to find an element with the exact name. <? //... @$DOM = new DOMDocument; @$DOM->loadHTML($html); @$finder = new DomXPath($DOM); foreach($finder->query("//a[contains(@title, '".$info[$i]."')]") as $link){...
asked by 12.01.2016 / 14:29
1
answer

How to iterate to get all xpath-evaluate results

In general to iterate% elements xpath I use a loop like this: <?php $dom = new DOMDocument; $dom->loadHTML('<div class="xGh">Test1</div><div class="xGh">Test2</div><div class="xGh">Test3</div>')...
asked by 01.11.2017 / 15:59