Curl returning 'Resource id #2 ' as response why?

爱⌒轻易说出口 提交于 2020-01-26 02:35:07

问题


I have the following curl which does a SOAP request

$soap_do = curl_init();
            curl_setopt($soap_do, CURLOPT_URL,"http://uat-api.gafoorkp.in/services/simulator");
            curl_setopt($soap_do, CURLOPT_RETURNTRANSFER,true);
            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,"<?xml version='1.1'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:sas='http://uat-api.gafoorkp.in/services/simulator'><SOAP-ENV:Body><sas:Login><Username>demo</Username><Password>demo</Password></sas:Login></SOAP-ENV:Body></SOAP-ENV:Envelope>");
            // $report=curl_getinfo($soap_do);
            if(curl_exec($soap_do) === false)
            {                
                $err = 'Curl error: ' . curl_error($soap_do);
                curl_close($soap_do);
                echo $err;
            }
            else
            {
                curl_close($soap_do); 
                echo 'Operation completed without any errors';
                print_r($soap_do);
                // print_r($report);
            }

This code is giving me a response as 'Resource ID #2' in the browser where Im suppose to get an xml response.Why is this happening,is there something wrong with what im doing?

Also no curl error is returned

来源:https://stackoverflow.com/questions/26066015/curl-returning-resource-id-2-as-response-why

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!