curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: PHP HTTPS Proxy

From: beshoo <beshoo_at_gmail.com>
Date: Thu, 9 Feb 2017 23:22:41 +0200

I dont know how to apply it , please have a look :

<?php

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://whatismyip.org');
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
    curl_setopt($ch, CURLOPT_PROXY,
'https://0f5ee342326fecbfb582ed3dc3495fb10f8ebd56:4F11C6A666BF2B9F922309B29CC486F4CC48CA2900E7B7F8679D69E42786EA21@68.71.55.53:443
');
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

    curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
print $data = curl_exec($ch);
    curl_close($ch);

?>

Output :
* Rebuilt URL to: http://whatismyip.org/
* Trying 68.71.55.53...
* TCP_NODELAY set
* Connected to (nil) (68.71.55.53) port 443 (#0)
* Cipher selection:
ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* SSL certificate problem: unable to get local issuer certificate
* Curl_http_done: called premature == 0
* Closing connection 0

root_at_server [/root]# curl -V
curl 7.52.1 (x86_64-redhat-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.1e
zlib/1.2.3 c-ares/1.12.0 libssh2/1.8.0 nghttp2/1.6.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3
pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL
libz HTTP2 UnixSockets HTTPS-proxy Metalink
root_at_server [/root]#

On Tue, Feb 7, 2017 at 3:22 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Sun, 5 Feb 2017, beshoo wrote:
>
> regarding CURLPROXY_HTTP, there is noting in php named as
>> "CURLPROXY_HTTPS"... strange
>>
>
> Not strange at all, simply not implemented there yet. You could do it.
>
> But you can also specify the proxy as "https://proxy.example.com:1234"
> and then it should work even without PHP knowing about it!
>
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-02-09