Tuesday, May 3, 2016

PHP SoapClient https not working on XAMPP but work on IIS+PHP

 

IIS + PHP (work)

<?

$wsdlURL = ‘https://wsdlURL/dss.aspx?wdsl’;

// Initiate SOAP client
$params = array(
                        'encoding'                =>    'UTF-8',
                        'verifypeer'            =>    false,
                        'verifyhost'            =>    false,
                        'soap_version'            =>    SOAP_1_2,
                        'trace'                    =>    1,
                        'exceptions'            =>     1,
                        "connection_timeout"    =>     180,
                        'stream_context'        =>     stream_context_create($opts)
                        );

try

{

      $output = $client->function($functionRequest);

}

catch (Exception $e)
{
    echo "Error: " . $step . " " . $e->getMessage();
}

?>

Code it working on IIS 8.5 + PHP 5.6

but when run code on XAMPP 5.6.x it not working

please try to fix by using this code  below

<?

ini_set("soap.wsdl_cache_enabled","0");

$wsdlURL = ‘https://wsdlURL/dss.aspx?wdsl’;

// Initiate SOAP client
$opts = array(
                'ssl'=> array(
                    'ciphers' => 'SHA1',
                    'verify_peer' => false,
                    'verify_peer_name' =>false));
                   
            //SOAP 1.2 client
            $params = array(
                        'encoding'                =>    'UTF-8',
                        'verifypeer'            =>    false,
                        'verifyhost'            =>    false,
                        'soap_version'            =>    SOAP_1_2,
                        'trace'                    =>    1,
                        'exceptions'            =>     1,
                        "connection_timeout"    =>     180,
                        'stream_context'        =>     stream_context_create($opts)
                        );

try

{

      $output = $client->function($functionRequest);

}

catch (Exception $e)
{
    echo "Error: " . $step . " " . $e->getMessage();
}

?>

 

or try to use this code below for //Initial SOAP client section

// Initiate SOAP client
$opts = array(
                'ssl'=> array(
                'ciphers' => 'SHA1',
                'verify_peer' => false,
                'verify_peer_name' =>false,
                'curl_verify_ssl_peer' => false,
                'curl_verify_ssl_host' => false));

No comments:

Post a Comment