Hi I am trying to send POST request through CURL but its throwing an error which says
"Failed connect to qaservices.carrental.com:443; No error".
The username and password is already included in the soap header in an xml file
<?php
$filename = 'c:/v.xml';
$data = file_get_contents($filename);
$url = 'https://qaservices.carrental.com/wsbang/HTTPSOAPRouter/ws9071';
$soap_do = curl_init();
curl_setopt($soap_do, CURLOPT_URL, $url );
curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_TIMEOUT, 10);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_POST, true );
curl_setopt($soap_do, CURLOPT_HEADER, 0 );
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($soap_do);
$err = curl_error($soap_do);
if ( curl_errno($soap_do) )
{
$result = 'ERROR -> ' . curl_errno($soap_do) . ': ' . curl_error($soap_do);
}
else
{
$returnCode = (int)curl_getinfo($soap_do, CURLINFO_HTTP_CODE);
switch($returnCode)
{
case 200:
break;
default:
$result = 'HTTP ERROR -> ' . $returnCode;
break;
}
}
curl_close($ch);
echo $result;
?>
When i try to send HttpWebRequest in vb.net this works. the copy of code in vb.net is
doc.Load("c:/v.xml")
Dim content As String = doc.InnerXml
Dim urlEncoded As String = content
Dim encodedRequest As Byte() = New ASCIIEncoding().GetBytes(urlEncoded)
Dim request As HttpWebRequest = DirectCast(WebRequest.Create("https://qaservices.carrental.com/wsbang/HTTPSOAPRouter/ws9071"), HttpWebRequest)
request.Method = "POST"
request.Accept = "*/*"
request.ContentType = "application/x-www-form-urlencoded"
' request.UserAgent = "Custom REST client v1.0"
request.ContentLength = encodedRequest.Length
request.Proxy.Credentials = CredentialCache.DefaultCredentials
Dim reqStream As Stream = request.GetRequestStream()
reqStream.Write(encodedRequest, 0, encodedRequest.Length)
reqStream.Flush()
reqStream.Close()
Dim response As HttpWebResponse = (request.GetResponse())
Dim responseStream As Stream = response.GetResponseStream()
Dim streamReader As New StreamReader(responseStream)
Dim responseContent As String = streamReader.ReadToEnd
I think it has to do something in setting up proxy credential Can anyone please guide me in correct path