-2

我是 PHP 和 MySQL 的新手,我编写了下面的代码,以启用批量短信发送,其中电话号码被选择用于数据库,电话号码位于不同的表格中,使用表格选择它们但无法发送群发短信的任何帮助将不胜感激。

     if (!$con)
     {
     die('Could not connect: ' . mysql_error());
      }

       mysql_select_db("demo_forum", $con);

       if($result = mysql_query("SELECT phn_number FROM gen");
  ($row = mysql_fetch_array($result))

       elseif ($result = mysql_query("SELECT phn_number FROM tec"); 
  ($row = mysql_fetch_array($result))

  elseif ($result = mysql_query("SELECT phn_number FROM news"); 
    ($row = mysql_fetch_array($result))

   elseif ($result = mysql_query("SELECT phn_number FROM pol");
    ($row = mysql_fetch_array($result))

   else ($result = mysql_query("SELECT phn_number FROM pol, gen, news, tec"); 
    ($row = mysql_fetch_array($result))

     function sendSmsMessage($phn_number, $message)
      {
     $ch= curl_init();curl_setopt($ch, "http://$gw_host/process_sm/sendsms.php?to=$phn_numbermessage=.urlencode($message");
      curl_exec($ch);
      curl_close($ch);

       }
4

1 回答 1

1
 $ch= curl_init();curl_setopt($ch, "http://$gw_host/process_sm/sendsms.php?to=$phn_numbermessage=.urlencode($message");

缺少与号 (&)分隔查询字符串中的不同字段,并且您的字符串包含文字.urlencode($message,因为您的第二个“位置不正确

尝试

 $ch= curl_init();curl_setopt($ch, "http://$gw_host/process_sm/sendsms.php?to=$phn_number&message=" . urlencode($message));
于 2012-06-10T16:12:05.880 回答