Piya
Piya

Reputation: 1144

Getting string instead of xml response in curl

I have the following curl request

$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='.urlencode($string).'&date='.urlencode($date).'&custacc=1234567890&udf1=ajeesh&[email protected]&udf3=940000000&udf4=arrackaparmabilhouse&ru=http://www.zwitch.co';
        $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, false);  
        echo $auth = curl_exec($curl);

Im getting this

http://test/paynetz/epi/ftsNBFundTransfer267050dHwIMJR%2FucGOZcnocTnwvISAVaeNZK93Y8veI%2Bb1DtY%3D11

Instead of an xml.Im getting the values only not the xml.

I had 505 error inthe response,so I used urlencode($string) instead of $string

Upvotes: 0

Views: 652

Answers (1)

Jonnerz
Jonnerz

Reputation: 1161

Have you tried adding curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'); This will confirm that you are a human rather than a bot.

If you are trying to output the XML directly onto a web page, you'll might want to lookup htmlentities().

Upvotes: 1

Related Questions