简体   繁体   English

在curl中获取字符串而不是xml响应

[英]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&udf2=sam@zz.com&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. 而不是xml.Im仅获取值而不是xml。

I had 505 error inthe response,so I used urlencode($string) instead of $string 我的响应中出现505错误,因此我使用urlencode($ string)代替了$ string

Have you tried adding curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'); 您是否尝试添加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(). 如果您尝试将XML直接输出到网页上,则可能需要查找htmlentities()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM