G
G
ganbatte2018-11-10 06:37:00
PHP
ganbatte, 2018-11-10 06:37:00

How to make an xpath query from the requested result?

Here is my code

$content = curl_exec($ch);
curl_close($ch);
$domDocument = new DOMDocument();
@$domDocument->loadHTML($content);

$xPath = new DOMXPath($domDocument);


$pElement = $xPath->query('/html/body/section/div/div');

foreach($pElement as $element){
echo $domDocument->saveHTML($element);
}

Here I made a request and got the result "$pElement = $xPath->query('/html/body/section/div/div');"
From this result how it is possible to make still other request?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-11-10
@ganbatte

New XPath query relative to previous XPath query?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question