PHP Simple HTML DOM Parser works without id reference or class?

1

I want to use the PHP Simple HTML DOM Parser to remove certain links from a page generated on the frontpage the problem I found is the following as the frontpage does not generate any html element with id or class I would like to know if it is possible to indicate a path for this to be done

  

The page where I want to remove the links is not mine, I'm just extracting data from it

    
asked by anonymous 15.01.2015 / 13:40

1 answer

1

Yes. You should use a property called XPath , which indicates the path of an element in the DOM (document object model).

To get the XPath of an element, simply access the Elements tab of the Developer Tools (in the case of Google Chrome), inspect the element in question and then copy your XPath:

  

    

In the case of the link above, for example, his XPath is:

//*[@id="supertopo"]/div[1]/div[1]/ul/li[1]/a

I hope I have helped. :)

    
15.01.2015 / 13:58