Simple Issue With cURL
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. So i need help on where i am doing something wrong.Here is my code. Thanks.
include 'sms_connect.php';
$sql="select name from sms";
$result=mysqli_query($link,$sql);
while($row=mysqli_fetch_assoc($result))开发者_如何学C
{
$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);
Do
$results = $curl_exec($ch);
echo $results;
Look at the output. If you get the output you expect, the problem is when you insert the data in the database, if not - you have a problem with your cURL, and post the error message here.
精彩评论