<i id='Rt8zj'><tr id='Rt8zj'><dt id='Rt8zj'><q id='Rt8zj'><span id='Rt8zj'><b id='Rt8zj'><form id='Rt8zj'><ins id='Rt8zj'></ins><ul id='Rt8zj'></ul><sub id='Rt8zj'></sub></form><legend id='Rt8zj'></legend><bdo id='Rt8zj'><pre id='Rt8zj'><center id='Rt8zj'></center></pre></bdo></b><th id='Rt8zj'></th></span></q></dt></tr></i><div id='Rt8zj'><tfoot id='Rt8zj'></tfoot><dl id='Rt8zj'><fieldset id='Rt8zj'></fieldset></dl></div>

    <small id='Rt8zj'></small><noframes id='Rt8zj'>

    <legend id='Rt8zj'><style id='Rt8zj'><dir id='Rt8zj'><q id='Rt8zj'></q></dir></style></legend>

      <tfoot id='Rt8zj'></tfoot>
      • <bdo id='Rt8zj'></bdo><ul id='Rt8zj'></ul>
    1. 如何使用带有 cURL 的 SOCKS 5 代理?

      How to use a SOCKS 5 proxy with cURL?(如何使用带有 cURL 的 SOCKS 5 代理?)

          <i id='h7oxi'><tr id='h7oxi'><dt id='h7oxi'><q id='h7oxi'><span id='h7oxi'><b id='h7oxi'><form id='h7oxi'><ins id='h7oxi'></ins><ul id='h7oxi'></ul><sub id='h7oxi'></sub></form><legend id='h7oxi'></legend><bdo id='h7oxi'><pre id='h7oxi'><center id='h7oxi'></center></pre></bdo></b><th id='h7oxi'></th></span></q></dt></tr></i><div id='h7oxi'><tfoot id='h7oxi'></tfoot><dl id='h7oxi'><fieldset id='h7oxi'></fieldset></dl></div>

            1. <tfoot id='h7oxi'></tfoot>
              <legend id='h7oxi'><style id='h7oxi'><dir id='h7oxi'><q id='h7oxi'></q></dir></style></legend>

              <small id='h7oxi'></small><noframes id='h7oxi'>

                <bdo id='h7oxi'></bdo><ul id='h7oxi'></ul>
                  <tbody id='h7oxi'></tbody>
                本文介绍了如何使用带有 cURL 的 SOCKS 5 代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                普通代理(例如:72.41.132.22:3128)与 cURL 配合良好,但是当我使用带有用户名/密码的 SOCKS 5 代理时,它只会在页面上显示[1".

                Normal proxies (ex: 72.41.132.22:3128) work well with cURL, however when I use SOCKS 5 proxies with username/pass, It just gives me "[1" on the page.

                有没有办法在 cURL 中使用 SOCKY 5 代理?

                Is there a way to use SOCKY 5 proxies with cURL ?

                $proxy = "cagsan:jw22wdw@108.61.25.223:34792";
                
                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL,$url);
                curl_setopt($ch, CURLOPT_PROXY, $proxy);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
                curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($ch, CURLOPT_HEADER, 1);
                $curl_scraped_page = curl_exec($ch);
                curl_close($ch);
                

                推荐答案

                你需要告诉 cURL 代理是一个 SOCKS5 代理,否则 cURL 假定它是一个 HTTP 代理:

                You need to tell cURL the proxy is a SOCKS5 proxy, otherwise cURL assumes it's an HTTP proxy:

                curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
                

                来自文档:

                CURLOPT_PROXYTYPE

                CURLPROXY_HTTP(默认)或 CURLPROXY_SOCKS5.

                Either CURLPROXY_HTTP (default) or CURLPROXY_SOCKS5.

                这篇关于如何使用带有 cURL 的 SOCKS 5 代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Proxy Authentication Required with cURL(cURL 需要代理身份验证)
                How to use HTTP_X_FORWARDED_FOR properly?(如何正确使用 HTTP_X_FORWARDED_FOR?)
                file_get_contents behind a proxy?(代理后面的 file_get_contents ?)
                pecl install cassandra throws: quot;error: Unable to load libcassandraquot;(pecl install cassandra 抛出:“错误:无法加载 libcassandra)
                Installing php datastax driver on ubuntu(在 ubuntu 上安装 php datastax 驱动)
                Which PHP client library to use with Cassandra?(哪个 PHP 客户端库与 Cassandra 一起使用?)

                      1. <tfoot id='cDyff'></tfoot>

                        <i id='cDyff'><tr id='cDyff'><dt id='cDyff'><q id='cDyff'><span id='cDyff'><b id='cDyff'><form id='cDyff'><ins id='cDyff'></ins><ul id='cDyff'></ul><sub id='cDyff'></sub></form><legend id='cDyff'></legend><bdo id='cDyff'><pre id='cDyff'><center id='cDyff'></center></pre></bdo></b><th id='cDyff'></th></span></q></dt></tr></i><div id='cDyff'><tfoot id='cDyff'></tfoot><dl id='cDyff'><fieldset id='cDyff'></fieldset></dl></div>

                        <legend id='cDyff'><style id='cDyff'><dir id='cDyff'><q id='cDyff'></q></dir></style></legend>
                          <tbody id='cDyff'></tbody>
                          <bdo id='cDyff'></bdo><ul id='cDyff'></ul>

                          <small id='cDyff'></small><noframes id='cDyff'>