-1

I know there is the javascript getBoundingClientRect() to retrieve the position of an element on a web page, but i need to write a script (preferably in php) that take a list of url and retrieves the position of a specific element on every page (an <a href="specificurl">).

The position could be expressed in px, or it could be "it's in header", "it's in footer", "it's in sidebar" (that way it's better for my purpose).

There is a method to do it in "simple" way?

ACA
  • 47
  • 6
  • You cannot get position of a url using PHP because PHP is not able to "see" the user interface as you do in a browser. – Kristoffer Bohmann Oct 03 '15 at 08:46
  • You should be able to read the contents of each URL using PHP, and use some sort of HTML parser to find out what their parent is. However, HTML is structural in nature, not visual, so the exact position of an element in two identical pages could be vastly different depending on, for example, their CSS properties. – Michael McMullin Oct 03 '15 at 09:02

1 Answers1

0

Look into a web scraper such as Guette, Simple HTML DOM or cURL / libcurl. This is however not "simple".

See also this related question: screen scraping technique using php.

Community
  • 1
  • 1
Kristoffer Bohmann
  • 3,986
  • 3
  • 28
  • 35