从卷曲中提取结果


extract result from curl

下面的代码会返回结果,但我如何从结果中提取余额以输入到db?

extract($_POST)
$url="http://sms.bbnplace.com/bulksms/acctbals.php?username=xxx@yahoo.com&password=xxxpass";
//}
$fields = array(
        );

//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
//}                 
//execute post
$result = curl_exec($ch);


//if ($result == '1801') { echo " is the SMS Credit Balance";} else { echo "Oooops, balance not seen";}
//close connection
curl_close($ch);

提前谢谢。

添加:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);