【发布时间】:2017-05-01 21:00:19
【问题描述】:
一直在尝试使用本地创建的 SOCKS 代理,使用 ssh -D 通过跳转服务器代理一个肥皂调用。
我的网络服务器无法直接访问我尝试使用的设备,所以我想我可以使用 SSH 代理。
我可以从 linux 服务器上的 Web 浏览器访问 wsdl,但 curl 失败。
我已使用 TCP Dump 验证流量正在从网络接口流出,并且在尝试使用代码时未命中代理的环回。如果我使用网络浏览器,它会像预期的那样通过环回代理。
<?
require_once 'SOAP/Client.php';
$username = "testuser";
$password = "testpass";
$hostname='10.200.96.86';
$soapoptions = array('namespace' => 'urn:iControl');
$wsdl_url ="https://$hostname/iControl/iControlPortal.cgi?WSDL=LocalLB.Pool";
$proxy_parms = array( 'user' => $username, 'pass' => $password);
$params = array();
$client = new SOAP_Client($wsdl_url, true, '', $proxy_parms );
$client->setOpt('curl', CURLOPT_VERBOSE, true)
$client->setOpt('curl', CURLOPT_SSL_VERIFYPEER, 0);
$client->setOpt('curl', CURLOPT_SSL_VERIFYHOST, 0);
$client->setopt('curl', CURLOPT_PROXYTYPE, "CURLPROXY_SOCKS5");
$client->setopt('curl', CURLOPT_PROXY, "localhost:1080"); // 1080 is your -D parameter
$response = $client->call('get_list', $params, $soapoptions);
if (PEAR::isError($response)) {
print "an error occurred in the call " . $response;
}
?>
【问题讨论】:
标签: php soap proxy soap-client pear