Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Gravity Forms data to SOAP Service says Could not connect to host WordPress

  • REFUNDED

I want to send some selected fields of a gravity form to a soap service whenever a user/visitor submits form

This is the soap markup the service provider gave me:

Web Raw Details

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>




After reading around i finally modified my code to the below but now when you submit a form it says: Could not connect yo host

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);
}

Answers (0)

No answers yet.