E
E
Express7772015-09-25 08:55:27
PHP
Express777, 2015-09-25 08:55:27

How to get the content of a page that is loaded via AJAX?

Hello dear.

There is a task.
Get page content in PHP.
I used to do this fairly easily via file_get_contents( $url ). But on one site, the list of goods is loaded by ajax-om, or rather by angular. That is, if you open such a page in a browser, you will have a loader spinning and after a while goods will appear.

The file_get_contents( $url ) function gets the raw code, i.e. like

<div class="spisok" data-ng-repeat="tovar in models.tovari">
  <span>
     {{tovari.name}}
   </span><br/>
</div>


How to get processed (loaded) page content?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
littleguga, 2015-09-25
@Express777

phantomjs stackoverflow
answer

K
Karponter, 2015-09-25
@karponter

Thinking aloud...
... parse the resulting file, get the agex request links, go there yourself and get everything you need ...
... shell execute + console browser that understands JS, not sure how to catch the timeout of the agex there ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question