A
A
Alexander Shapoval2017-07-20 01:20:23
PHP
Alexander Shapoval, 2017-07-20 01:20:23

How to parse an https site using a proxy?

For parsing, the Snoopy library is used, which uses stream_socket_client () for the connection.
It copes with the task except for one site that palms off a secure connection, when using a proxy, it is impossible to parse a site with such a connection, is there a way to access the site using a non-secure protocol?
Banal prescribing in the address http instead of https does not help.
If you ignore the error that the site uses https, then as a result I will get the page
301 Moved Permanently
nginx

[response_code] => HTTP/1.1 301 Moved Permanently

    [headers] => Array
        (
            [0] => HTTP/1.1 301 Moved Permanently

            [1] => Server: nginx

            [2] => Date: Wed, 19 Jul 2017 22:13:10 GMT

            [3] => Content-Type: text/html

            [4] => Content-Length: 178

            [5] => Location: https://pdalife.ru/

            [6] => X-Cache: MISS from Kluay03

            [7] => X-Cache-Lookup: MISS from Kluay03:8888

            [8] => Via: 1.1 Kluay03 (squid/3.3.8)

            [9] => Connection: close

        )

In Snoopy, when using a proxy and a site with https, we get the following
trigger_error("HTTPS connections over proxy are currently not supported", E_USER_ERROR)

If this is ignored, we get
Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol in /var/www/software/Core/Snoopy.php on line 879
Warning : stream_socket_client(): Failed to enable crypto in /var/www/software/Core/Snoopy.php on line 879
Warning: stream_socket_client(): unable to connect to ssl://58.97.48.36:8888 (Unknown error) in / var/www/software/Core/Snoopy.php on line 879

Line 879 on the screenshot0963a10a732a4d75a0bb0738987f81ef.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question