U
U
Us592020-06-03 15:42:29
PHP
Us59, 2020-06-03 15:42:29

How to parse data in this case?

I look at F12 (Network) in the browser and see what happens.
I see that the browser is making a POST request, I look at the headers of this request and I see that the Request Headers contain "Tokens", without which, if I make a cURL request, I get an error, i.e. the server checks for these tokens.

The question arises: how are these tokens generated, after digging around, I understand: these tokens are generated through Javascript , below is the photo of the POST request I need and in the initiator I see links to .js , hence I concluded that the tokens are generated by it.
5ed7979a9ba0d391781664.png

I ’ll clarify that I looked through and searched for these same tokens in previous requests, the html page, etc. ... empty .. I didn’t find anything.

QUESTION: How to parse data from such sites that generate through JS tokens that need to be sent in header requests in order to get the desired results?
My script is written in PHP so I need something that can be combined/called with php.


I will immediately answer Selenium lovers: The data that I want to receive is not displayed to the user of the site, it is not in the HTML page, jsonI find the data in the format in a POST request in the browser, browsing F12 -> Network, and as I understand Selenium will not be able to pull out this very json.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2020-06-03
@AUser0

In fact, AJAX requests are always generated by JavaScript, that's their essence.
And so, you need to parse these JS, make sure that the tokens are generated in them, and repeat the JS generation using PHP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question