Gravity表单数据到SOAP服务表示无法连接到主机



每当用户/访问者提交表单时,我想将重力表单的一些选定字段发送到soap服务

这是服务提供商给我的soap标记:

Web原始详细信息

POST http://192.168.1.20:443/callpack.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/callbalance"
Content-Length: 443
Host: 192.168.1.20:443
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:callpack>
<tem:username>root</tem:username>
<tem:password>admin123</tem:password>
<tem:sendernum>18002264180</tem:sendernum>
<tem:receivernum>18007264316</tem:receivernum>
<tem:unitId>pack_1_55972</tem:unitId>
<tem:minutes>70</tem:minutes>
</tem:callpack>
</soapenv:Body>
</soapenv:Envelope>

////更新///

经过阅读,我最终将我的代码修改为以下内容,但现在当你提交一份表格时,它说无法连接你的主机

add_action( 'gform_after_submission_1', 'post_to_third_party', 10, 2 );
function post_to_third_party( $entry, $form ) {
$location = 'http://192.168.1.20:443/callpack.asmx?wsdl'; 
$params = array(
'username' => "root",
'Password' => "admin_123",
'mainnum' => "18002264180",
'receivernum'  => $entry["1"],
'unitId'    => "pack_1_55972",
'minutes'   => $entry["15"],
);

$options = array(
'ssl_method' => SOAP_SSL_METHOD_TLS,
'encoding'=>'UTF-8',
'cache_wsdl'    => WSDL_CACHE_NONE,
'stream_context'=> stream_context_create(
array(
'ssl'=> array(
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
'ciphers' => 'SHA256',
'verify_peer'=>false,
'verify_peer_name'=>false, 
'allow_self_signed' => true
)
)
)
);
try {
$soap = new SoapClient($location, $options);
$data = $soap->callpack($params);
}
catch(Exception $e) {
die($e->getMessage());
}
print_r($data);
}

是什么原因造成的?

尝试在以下行中添加分号而不是逗号:

$username = "root";
$password = "admin_123";
$mainnum = "18006318990";
$random_num = rand(1000,9999);

最新更新