2011-10-10 115 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有問題,並在這裏發佈錯誤信息。