多次运行该数组

时间:2010-06-28 07:01:28

标签: php sql

现在我的脚本连接到api并一次发送一个sms,1个数字。我希望它从本地sql db中提取,然后对db中的每个数字重复响应。

$data['post'] = array (
    '_rnr_se'     => $rnrse,
    'phoneNumber' => '1234567890', 
    'text'        => 'This is a test SMS!',
    'id'          => '' 
);

// Send the SMS
$response = xcurl::fetch('api.phonegateway.com/', $data);

// Evaluate the response
$value = json_decode($response['data']);

我该怎么做?

1 个答案:

答案 0 :(得分:0)

docs

复制
mysql_connect("localhost", "mysql_user", "mysql_password") or
    die("Could not connect: " . mysql_error());
mysql_select_db("mydb");

$result = mysql_query("SELECT id, name FROM mytable");

while ($row = mysql_fetch_array($result)) {
    $data['post'] = array ( '_rnr_se' => $row['number'], 'phoneNumber' => $row['phone_number'], 'text' => $row['text'], 'id' => '' );

// Send the SMS $response = xcurl::fetch('api.phonegateway.com/', $data);

// Evaluate the response $value = json_decode($response['data']);` 
}