解析数据时如何使用PHP访问下一个链接[关闭]

My idea basically is like this:

Enter an $url this url has like 20 items and at the bottom there's page 1,2,3,4....10 and > for next, what i want is that he access this page sees if there's > by the css selector id or class till there's none and after that stops, how can i do this?

this is used for parsing data, and i want to do it all at once like this is the main $url so parse the data then, check if it's the last page if not, the $url' become the next page$url`.

I hope I was clear enough.

... how can i do this?

I'd say right now you can't do it. You're missing to program it I assume from what you ask for therefore the answer is that you can do it by programming it.

One problem albeit remains. PHP has no CSS selectors. Those are in the DOM of the Browser but not in PHP's DOM. Therefore you need to find a solution to not use CSS selectors but instead query the document differently, for example with XPath which is supported in version 1.0 by PHP's DOM.