Domanda

I am a newbie in PHP and MySQL i have written the code below to enable sending of bulk sms with the phone number being picked for a database with the phone number being in different tables where they are selected using a form but am not able to send the bulk sms's any help will be highly appreciated.

     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);

       }
È stato utile?

Soluzione

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

lacks the ampersand (&) seperating the different fields in your query string and your string contains the literal .urlencode($message due to your incorrect placement of the second "

try

 $ch= curl_init();curl_setopt($ch, "http://$gw_host/process_sm/sendsms.php?to=$phn_number&message=" . urlencode($message));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top