php curl_exec输出到变量

时间:2016-05-26 12:28:39

标签: php

我想在php $ variables中获取返回值

我现在得到的是这样的

ok true 10007.20 cd3f2d61-c929-4a6e-a587-33878fb2b836 200

虽然我想在变量中得到它:

  • $ value1 =' ok&#39 ;;
  • $ value2 =' true';
  • $ value3 =' 10007.20';

    $ch = curl_init();
    
    curl_setopt($ch, CURLOPT_URL,"https://www.smsbox.com/SMSGateway/Services/Messaging.asmx/Http_SendSMS");
    
    curl_setopt($ch, CURLOPT_POST, 1);
    
    curl_setopt($ch, CURLOPT_POSTFIELDS,"username=".$username."&password=".$password."&customerId=".$cutomerId."&senderText=".$senderText."&messageBody=".$messageBody."&recipientNumbers=".$recipientNumbers."&defdate=&isBlink=false&isFlash=false");
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $content = curl_exec($ch);
    echo $content;
    
    curl_close ($ch); 
    

echo htmlentities($ content);

ok true 10005.20 4ce81f05-31cb-40c4-93e2-fd68bf50fc23 version =" 1.0"编码=" UTF-8">的xmlns:=的xsi" HTTP://www.w3.org/2001/XMLSchema-instance"的xmlns:XSD =" HTTP://www.w3.org/2001/XMLSchema"的xmlns =" HTTP://itbsms.com/"> ok true 10006.20 3320429f-59b8-47fc-a49e-3e209a472b16 />

1 个答案:

答案 0 :(得分:0)

使用explode获取数组中的值:

$values = explode(' ', $content);