Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
599 views
in Technique[技术] by (71.8m points)

ssl - Call SOAP API with cURL in PHP - wrong cipher returned

I'm trying to call a SOAP API through a proxy. And I'm using cURL for that in my PHP script. It works fine for WSDL files with no SSL. But when trying to access WSDL files over "https" it throws the following error.

"error:1421C105:SSL routines:set_client_ciphersuite:wrong cipher returned"

This same error is thrown even if I used Guzzle.

Here's my cURL script.

    $ch = curl_init();
    $timeout = 1000;
    curl_setopt($ch, CURLOPT_URL, "https://<ip-here>:8080/wsdl/file/url");

    //Tell cURL where our certificate bundle is located.
    $certificate = "C:/xampp/cacert.pem";
    curl_setopt($ch, CURLOPT_CAINFO, $certificate);
    curl_setopt($ch, CURLOPT_CAPATH, $certificate);

    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

    curl_setopt($ch, CURLOPT_PROXY, "http://localhost:1338");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_ENCODING, "");
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HTTP_VERSION, 'CURL_HTTP_VERSION_1_1');
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: text/xml']);
    curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'DEFAULT@SECLEVEL=1');
    curl_setopt($ch, CURLOPT_POSTFIELDS, '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rm="rm:soap">
       <soapenv:Header/>
       <soapenv:Body>
          <rm:getGroupMemberList>
             <inPara>
                <subscriberGroupMemberQuota>
                   <attribute>
                      <key>GRPIDENTIFIER</key>
                      <value>420722009813</value>
                   </attribute>
                </subscriberGroupMemberQuota>
             </inPara>
          </rm:getGroupMemberList>
       </soapenv:Body>
    </soapenv:Envelope>
    ');


    $data = curl_exec($ch);

    if ($data === false) {
        dd(curl_error($ch));
        throw new Exception(curl_error($ch), curl_errno($ch));
    }
    curl_close($ch);

I tried everything mentioned in the previous answers in SO. Can you guys see what's wrong with this request ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...