i am in the closing stages of an sms application that will send different sms messages to different phone numbers. I will be using an sms gateway and my research led me to use cURL to implement the smpp api of the company that has the gateway. I was doing a test run of cURL on my localhost to see if all went smoothly before i implemented on the application(i wanted it to insert values into a table), but it was not working. I turned error reporting on and this is what i got:
My original code is:
Thanks..
Code:
Notice: Use of undefined constant link - assumed 'link' in /srv/www/htdocs/sms/sms_connect.php on line 6 Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in /srv/www/htdocs/sms/load.php on line 9 Notice: Undefined variable: ch in /srv/www/htdocs/sms/load.php on line 32 Warning: curl_close() expects parameter 1 to be resource, null given in /srv/www/htdocs/sms/load.php on line 32
Code:
include 'sms_connect.php';
$sql="select name from sms";
$result=mysqli_query($link,$sql);
while($row=mysqli_fetch_assoc($result))
{
$name=$row['name'];
$url = "http://localhost/sms/index.php?name=".$name;
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
}
// close cURL resource, and free up system resources
curl_close($ch);