2011-10-10 109 views
-2

我正处于短信应用程序的最后阶段,它将发送不同的短信到不同的电话号码。我将使用短信网关,并且我的研究使我使用cURL来实现具有网关的公司的smpp api。我在我的本地主机上做了一个cURL的测试运行,看看在应用程序上实现之前是否一切顺利(我希望它将值插入到表中),但它不起作用。所以我需要帮助,我在哪里做错了什么。这是我的代码。谢谢。简单问题与卷曲

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

定义不起作用。任何错误消息?日志中的任何内容?什么都可以? –

+0

你有没有在php.ini中加载cURL模块? (取消注释'extension = php_curl.dll')。试试'$ output = curl_exec($ ch); var_dump($ output);' – Benno

+0

我的意思是它没有将数据插入到我的本地主机上的数据库 – ewom2468

回答

1

$results = $curl_exec($ch); 
echo $results; 

查看输出。如果你得到你期望的输出,问题是当你将数据插入数据库时​​,如果没有 - 你的cURL有问题,并在这里发布错误信息。