Created
March 31, 2018 01:06
-
-
Save jviveiros/774139c04416afeee7f08fa21ab62b65 to your computer and use it in GitHub Desktop.
PHP Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
$username = getenv("FORWARD_HTTP_PROXY_USERNAME"); | |
$password = getenv("FORWARD_HTTP_PROXY_PASSWORD"); | |
$forward_proxy = getenv("FORWARD_HTTP_PROXY_HOST"); | |
$reverse_proxy = getenv("REVERSE_HTTP_PROXY_HOST"); | |
$client = new GuzzleHttp\Client(); | |
function reveal_via_forward_proxy($redact_data) | |
{ | |
global $forward_proxy, $username, $password, $client; | |
$proxies = explode(":", $forward_proxy); | |
$response = $client->post("https://httpbin.verygoodsecurity.io/post", [ | |
'headers' => [ | |
"Content-type" => "application/json", | |
"VGS-Log-Request" => "all" | |
], | |
'auth' => [$username, $password], | |
'curl' => [ | |
CURLOPT_PROXY => $proxies[0], | |
CURLOPT_PROXYPORT => (int)$proxies[1], | |
CURLOPT_PROXYUSERPWD => "$username:$password", | |
], | |
'verify' => "./cert.pem", | |
'body' => $redact_data | |
] | |
); | |
return json_decode($response->getBody(), true)['data']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment