J
J
Junior0072016-11-15 21:40:04
Parsing
Junior007, 2016-11-15 21:40:04

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?
9adac4200bd843b9acfd0564e679c48e.PNGUDP : 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
1e5c48e5f1094903a4dc39e80081d7db.PNG

Answer the question

In order to leave comments, you need to log in

2 answer(s)
1
15432, 2016-11-15
@Junior007

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

I
Ilya, 2016-11-15
@glebovgin

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 question

Ask a Question

731 491 924 answers to any question