Page 1 of 1

PHP - Find difference in 2 strings and get path to difference

Posted: Mon Oct 30, 2017 9:42 am
by deriklogov
I got 2 html files which use same template only some fields different and i need to get full xpath to those differences using PHP.

1st)

<html>
<body>
<div class="price">12,400</div>
<div class="make">Acura</div>

2nd)

<html>
<body>
<div class="price">15,400</div>
<div class="make">Bmw</div>

So as you can see from example its the same template but price is different and make So PHP script suppose to show xpath (those results):

//div[@class='price']
//div[@class='make']

Script needs to find difference in 2 files and get xpath to that difference, obviously template is unknown and every time could be different

Any Help Appreciated!!!

Re: PHP - Find difference in 2 strings and get path to difference

Posted: Mon Oct 30, 2017 1:41 pm
by hyper
I'm not sure what you are trying to achieve, but it seems that you are creating a problem that doesn't or shouldn't exist?

You have a template html file, and then populate the fields from your script; unless I'm misunderstanding you, why would you then want to extract that same data?

Re: PHP - Find difference in 2 strings and get path to difference

Posted: Mon Oct 30, 2017 2:04 pm
by benanamen
This sounds like a classic XY Problem, A.K.A help me fix my attempted solution. OP, tell us what the real problem is that you are trying to solve, not your attempt at solving it.

I don't see anything that resembles a proper "template".