cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

curl and ssl

From: Onur NEŞVAT <onurnesvat_at_gmail.com>
Date: Wed, 19 Dec 2012 15:42:51 +0200

Hi everyone,

I want to connect a API from https protocol. But the error is Unknown SSL
protocol error in connection to emea.copy-webservices.travelport.com:443

The code is :
$TARGETBRANCH = 'xxx';
$CREDENTIALS = 'Universal API/uAPI-774137105:emfdjHsZAjAjTffhhKCS3R6HP';
$message = <<<EOM
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:air="http://www.travelport.com/schema/air_v16_0"
xmlns:com="http://www.travelport.com/schema/common_v13_0" >
<soapenv:Header/>
   <soapenv:Body>
<air:AvailabilitySearchReq xmlns:air="
http://www.travelport.com/schema/air_v16_0"
xmlns:com="http://www.travelport.com/schema/common_v13_0"
AuthorizedBy="Test" TargetBranch="$TARGETBRANCH">
<air:SearchAirLeg>
<air:SearchOrigin>
                <com:Airport Code="LHR" />
</air:SearchOrigin>
<air:SearchDestination>
                <com:Airport Code="JFK" />
</air:SearchDestination>
<air:SearchDepTime PreferredTime="2011-11-08" />
</air:SearchAirLeg>
</air:AvailabilitySearchReq>
</soapenv:Body>
</soapenv:Envelope>
EOM;
$auth = base64_encode("$CREDENTIALS");
$soap_do = curl_init ("
https://emea.copy-webservices.travelport.com/B2BGateway/connect/uAPI/Service
");
$header = array(
    "Content-Type: text/xml;charset=UTF-8", "Accept: gzip,deflate",
"Cache-Control: no-cache",
    "Pragma: no-cache",
    "SOAPAction: \"\"",
    "Authorization: Basic $auth",
"Content-length: ".strlen($message),
);
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 300);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 300);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
echo curl_exec($soap_do);
echo curl_error($soap_do);

Thank You.

-- 
*Onur NEŞVAT**
*
*onurnesvat_at_gmail.com*

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2012-12-19