1

I was not getting the xml response which I was supposed to get when I excecuted the curl. But when curl getinfo, I'm getting the response code 505.

$url='http://test/paynetz/epi/fts?login=160&pass=Test@123&ttype=NBFundTransfer&prodid=NSE&amt=50&txncurr=INR&txnscamt=0&clientcode=TkFWSU4%3d&txnid='.$string
     .'&date='.$date

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
echo $auth = curl_exec($curl);
$response = curl_getinfo($curl);
echo "<pre>";
print_r($response);
echo "</pre>";

This is what I get

Array
(
    [url] => http://test/paynetz/epi/fts?login=160&pass=Test@123&ttype=NBFundTransfer&prodid=NSE&amt=50&txncurr=INR&txnscamt=0&clientcode=TkFWSU4%3d&txnid=56482&date=28/04/2014 22:24:53&custacc=1234567890&udf1=ajeesh&udf2=ajeesh@fethr.com&udf3=9400429941&udf4=arrackaparmabilhouse&ru
    [content_type] => 
    [http_code] => 505
    [header_size] => 126
    [request_size] => 333
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.451817
    [namelookup_time] => 0.000152
    [connect_time] => 0.224945
    [pretransfer_time] => 0.225027
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => 0
    [starttransfer_time] => 0.451794
    [redirect_time] => 0
    [certinfo] => Array
        (
        )

    [redirect_url] => 
)

Why am I getting the curl response?

Piya
  • 1,134
  • 4
  • 22
  • 42

2 Answers2

1

505 means HTTP version not supported, so I'm assuming CURL is trying to make the request using an HTTP version that is not supported by the other service. On your code try to see if you can tweak the HTTP version to 1.0 and see if it works.

eduardosasso
  • 529
  • 2
  • 8
1

Error 505 means that the server doesn't understand the HTTP version you're using. So just changing the HTTP version you're using could solve the problem for you.

Try using an older HTTP version, using CURLOPT_HTTP_VERSION.

If that doesn't solve your problem, try looking at this question: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported error

Community
  • 1
  • 1
Felipe
  • 11,557
  • 7
  • 56
  • 103