下面的代码回应了结果,但是如何从输入到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);
提前致谢。
答案 0 :(得分:1)
添加:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);