M
M
Matthew Stafford2019-05-05 22:24:48
PHP
Matthew Stafford, 2019-05-05 22:24:48

How to parse a site if it has JavaScripts that redirect to the main page?

Question in the header, thanks for the help!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pychev Anatoly, 2019-05-06
@pton

Most likely, you are redirected to the main page because you are not authorized.
Make the first request to the home page, save the cookie, then navigate to the desired pages.

E
Evgeny Nikolaev, 2019-05-17
@nikolaevevge

Perhaps when you display information, JavaScript is also displayed along with it.
That is, for example, you do this $html = file_get_contents("http + :// + domen + / + url");// wrote in such a format so that the link is not replaced,
then output echo $html;//and it turns out that JavaScript is displayed which is being executed and then, for example, realizing that you are on the wrong domain redirects you to another site.
To avoid this when debugging, output $html like this:
echo htmlspecialchars($html);// that is, escape the output of html tags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question