T
T
T4-1002014-05-02 11:14:16
PHP
T4-100, 2014-05-02 11:14:16

How to retrieve page content?

It is necessary to take the content of the page, but there are blocks on the page in which the data is written through js, that is, you need to get the content after all the js has been completed.
For example
, we have a block in which a certain rating is indicated, but this rating appears after the page is loaded (data is substituted through js)
How can I get the correct data?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-05-02
@isawillbenice

Purely in PHP - no way. You need a full browser for this. Look in the direction of phantomjs, with its help you can programmatically load the page, set a timeout of half a second (or how long it takes for js to work), and since you have full access to the DOM, you can immediately pick out all the data there and transfer it to where farther.

E
Eugene Obrezkov, 2014-05-02
@ghaiklor

The fastest crutch - use setTimeout().
Pseudocode:

setTimeout(function() {
    getRating();
}, 5000);

In 5 seconds, I think everything you need should already be loaded :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question