如何在php中将xml和非xml内容从变量拆分为新变量

时间:2014-10-29 07:16:44

标签: php xml

我变量中的示例内容是

HTTP/1.1 200 OK
Date: Wed, 29 Oct 2014 07:07:02 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.4
Vary: Accept-Encoding
Content-Length: 280
Content-Type: text/html

<?xml version="1.0"?>
<serviceResponse>                 
 <status>Success</status>
 <error/> 
 <pool_balance>100.00</pool_balance> 
 <kcm_wallet_balance>51.01</kcm_wallet_balance>                 
 <glo_wallet_balance>0.00</glo_wallet_balance>                 
</serviceResponse>

我只想要这部分

  <?xml version="1.0"?>
    <serviceResponse>                 
     <status>Success</status>
     <error/> 
     <pool_balance>100.00</pool_balance> 
     <kcm_wallet_balance>51.01</kcm_wallet_balance>                 
     <glo_wallet_balance>0.00</glo_wallet_balance>                 
    </serviceResponse>

不知道如何在单独的变量中获取这些内容

1 个答案:

答案 0 :(得分:1)

您需要将CURLOPT_HEADER设置为false以将其从响应中删除

尝试将CURLOPT_HEADER设置为false