curl_exec($ ch)的问题

时间:2017-01-25 10:23:51

标签: xml curl

为什么它总是返回true?

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);     
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($post_string),'SOAPAction:urn:RemoteUserStoreManagerServiceHttpsSoap11Endpoint','Authorization: Basic YWRtaW46YWRtaW4=' )); 

$data = curl_exec($ch);

if($data===true){
        echo"<script>location.assign('utente.php')</script>";
      }else{
        echo"<script>location.assign('index.php?a=0')</script>";
        }

我尝试了很多解决方案但没有一个成功

1 个答案:

答案 0 :(得分:0)

只需删除此行即可 curl_setopt($ ch,CURLOPT_RETURNTRANSFER,1);