Phpquery why loading the same page (pagination)?

Hello, the problem arose when trying to put multiple pages, the script parses only one page - first. And since I found the links in the pagination, I decided to try using the counter of results, and "custom" links, but couldn't find the bug which constantly parsed only one page.
For example, I took -

$a = 1;
$url = "".$a."_price_asc";

function parser($url) {
 global $a;
 $file = get_content($url);
 $doc = phpQuery::newDocument($file);
 $startlist = array();
 $endlist = array();
 foreach ($doc->find('#searchResults_ctn .market_paging_summary') as $page) {
 $page = pq($page);
 $startlist = $page->find('span[id=searchResults_end]')->html();
 $endlist = $page->find('span[id=searchResults_total]')->html();
 if ($startlist < $endlist) {
 foreach ($doc->find('#searchResultsRows .market_recent_listing_row') as $item) {
 $item = pq($item);
 $img = $item->find('.market_listing_item_img')->attr('src');
 $text = $item->find('.market_listing_item_name_block span[class=market_listing_item_name]')->html();
 $gold = $item->find('.market_listing_price_listings_block span[class=sale_price]');
 echo "<img src="$img">";
 echo $text;
 echo "Price: $gold";
 echo "<hr>";
 while ($startlist = $endlist) {
 $a = ++$a;
 $url = "".$a."_price_asc";
June 27th 19 at 16:13
1 answer
June 27th 19 at 16:15

First page:

Second page:

All that is necessary directly in JSON, what do You not do something, if I understand correctly
If you don't mind, can you recommend some reading on this subject, especially sample data from results_html. - nikita.Stracke commented on June 27th 19 at 16:18
: if You are just learning, you better try to parse simple sites on html, you can use any manual transmission.

In your case download content pages are dynamically (AJAX) so You won't be able to parse the content with PHP to parse the sites you need to use Selenium or PhantomJs, but it's more complicated.

Parsing dynamic sites

You can simply keep track of which requests a browser sends out, as did I (will help the firebug extension for Firefox, etc.) and just pick up all the content in JSON format.

For example:

The link shows that data queried from 0 to 10, this is the first page, change the parameters start and count to 10 and 20 respectively. we will get the second page, etc. - nicklaus.Will commented on June 27th 19 at 16:21
: Sorry for some "arrogance", and if I say I want to get 0 RUB. from all this it results_html, how best to proceed? - nikita.Stracke commented on June 27th 19 at 16:24
: narrow down your question - nicklaus.Will commented on June 27th 19 at 16:27
: here results_html this is the HTML that you need to parse, you can use phpQuery

Specifically on the sample using phpQuery see the documentation, as they will not be able to tell due to the fact that I did not work with him. - nicklaus.Will commented on June 27th 19 at 16:30

Find more questions by tags HTMLPHP