Answer the question
In order to leave comments, you need to log in
How to bypass the 302 code when connecting to a site?
Hello!
Please tell me how to bypass messages with codes 301 and 302 when trying to connect to some resources like youtube.com, yandex.com, etc. via HTTPS.
At the same time, when connecting, for example, to github.com, I get the page code without problems.
It turns out that YouTube somehow understands that I am a potential parser and bans the connection?
UDP : Added www - everything works, now there is a problem with the encoding of the received text (Headers are readable):
When outputting to a file - the same
Answer the question
In order to leave comments, you need to log in
I already wrote to you that the 302 code is not an error. You need to parse the response and send a request to the specified redirect link.
In your request https://youtube.com
you will be redirected to https://www.youtube.com
Good afternoon.
301 and 302 codes are redirects. In the same curl there is a CURLOPT_FOLLOWLOCATION directive, which will allow you to follow redirects, so to speak. Or make requests to those urls where the 200 code will definitely be given. Instead youtube.com
, make a request forhttps://www.youtube.com
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question