From 976472628d765617ad34a629b64ee0fd70673e0e Mon Sep 17 00:00:00 2001 From: Lars Novikov Date: Mon, 23 Jul 2018 22:56:49 -0700 Subject: [PATCH 1/4] add proxy auth --- src/Camcima/Soap/Client.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Camcima/Soap/Client.php b/src/Camcima/Soap/Client.php index 5d2e1c4..4dda840 100644 --- a/src/Camcima/Soap/Client.php +++ b/src/Camcima/Soap/Client.php @@ -72,6 +72,20 @@ class Client extends \SoapClient */ protected $proxyPort; + /** + * Proxy User + * + * @var string + */ + protected $proxyUser; + + /** + * Proxy Password + * + * @var string + */ + protected $proxyPass; + /** * Lowercase first character of the root element name * @@ -360,6 +374,21 @@ public function useProxy($host = self::DEFAULT_PROXY_HOST, $port = self::DEFAULT return $this; } + /** + * Set proxy auth data + * + * @param $user + * @param $passwd + * @return $this + */ + public function setProxyAuth($user, $passwd) + { + $this->proxyUser = $user; + $this->proxyPass = $passwd; + + return $this; + } + /** * Merge Curl Options * @@ -389,6 +418,7 @@ public function getCurlOptions() $mergedArray[CURLOPT_PROXYTYPE] = $this->proxyType; $mergedArray[CURLOPT_PROXY] = $this->proxyHost; $mergedArray[CURLOPT_PROXYPORT] = $proxyPort; + $mergedArray[CURLOPT_PROXYUSERPWD] = 'test:NOnEYQau'; } return $mergedArray; From 6ac144a59978156465db2a393e3cf7a5541bc254 Mon Sep 17 00:00:00 2001 From: Lars Novikov Date: Mon, 23 Jul 2018 22:57:46 -0700 Subject: [PATCH 2/4] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 04b8cb5..578cf09 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,14 @@ $soapClient->useProxy('proxy.local', 8080, CURLPROXY_SOCKS5); The default hostname, port and type for this methods are `localhost`, `8888` and `CURLPROXY_HTTP`, which is the default binding for Fiddler Web Debugging Proxy ([http://fiddler2.com/](http://fiddler2.com/)). +### Proxy Auth ### + +If your proxy need auth, you can use this method to set proxy username and password: +```php +setProxyAuth('proxy_user', 'proxy_password'); +``` + ### Authentication ### In order to use HTTP Authentication, use SoapClient original `login` and `password` options. The cURL client will get it from there. From 570e933215988b28108202e92684d485089932fd Mon Sep 17 00:00:00 2001 From: Lars Novikov Date: Mon, 23 Jul 2018 23:31:02 -0700 Subject: [PATCH 3/4] remove test credentials --- src/Camcima/Soap/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Camcima/Soap/Client.php b/src/Camcima/Soap/Client.php index 4dda840..0456ff4 100644 --- a/src/Camcima/Soap/Client.php +++ b/src/Camcima/Soap/Client.php @@ -418,7 +418,7 @@ public function getCurlOptions() $mergedArray[CURLOPT_PROXYTYPE] = $this->proxyType; $mergedArray[CURLOPT_PROXY] = $this->proxyHost; $mergedArray[CURLOPT_PROXYPORT] = $proxyPort; - $mergedArray[CURLOPT_PROXYUSERPWD] = 'test:NOnEYQau'; + $mergedArray[CURLOPT_PROXYUSERPWD] = $this->proxyUser . ':' . $this->proxyPass"; } return $mergedArray; From bf90e8150d9ea34d89fac8ad4c13eed28edba58d Mon Sep 17 00:00:00 2001 From: Lars Novikov Date: Tue, 24 Jul 2018 00:09:39 -0700 Subject: [PATCH 4/4] fix " --- src/Camcima/Soap/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Camcima/Soap/Client.php b/src/Camcima/Soap/Client.php index 0456ff4..be926ec 100644 --- a/src/Camcima/Soap/Client.php +++ b/src/Camcima/Soap/Client.php @@ -418,7 +418,7 @@ public function getCurlOptions() $mergedArray[CURLOPT_PROXYTYPE] = $this->proxyType; $mergedArray[CURLOPT_PROXY] = $this->proxyHost; $mergedArray[CURLOPT_PROXYPORT] = $proxyPort; - $mergedArray[CURLOPT_PROXYUSERPWD] = $this->proxyUser . ':' . $this->proxyPass"; + $mergedArray[CURLOPT_PROXYUSERPWD] = $this->proxyUser . ':' . $this->proxyPass; } return $mergedArray;