从卷曲中提取结果

时间:2014-10-25 21:34:23

标签: php 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);

提前致谢。

1 个答案:

答案 0 :(得分:1)

添加:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
相关问题