curl と PHP を使用して fullonsms.com SMS ゲートウェイを使用して SMS を送信しようとしています。
ここにコードがあります:-
 <?php
    session_start();
    mysql_connect('localhost','root','') or die('Error connecting to database');
    mysql_select_db('SMSapp') or die('Database Selection Error');
    $query='Select * from contacts';
    $cookie_file_path = "/cookie.txt"; 
    $username="*****";
    $password="***";
    $message=urlencode("Hi buddy");  
    $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"http://sms.fullonsms.com/login.php");    
    curl_setopt($ch, CURLOPT_USERAGENT, $agent);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "MobileNoLogin=$username&LoginPassword=$password&x=16&y=14");
    $html=curl_exec($ch);        
    if($query_run=mysql_query($query))
    {
        $row_count=mysql_num_rows($query_run);
        if($row_count==0)
        {
            echo 'Zero rows received';
            die();
        }  
        else 
        {
            for($i=0;$i<3;$i++)
            {
                curl_setopt($ch, CURLOPT_URL,"http://sms.fullonsms.com/home.php");    
                curl_setopt($ch, CURLOPT_USERAGENT, $agent);
                curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
                curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
                curl_setopt($ch, CURLOPT_HEADER, 1);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                $tomobno=mysql_result($query_run,$i,'mobno');
                curl_setopt($ch, CURLOPT_POSTFIELDS, "ActionScript=%2Fhome.php&CancelScript=%2Fhome.php&HtmlTemplate=%2Fvar%2Fwww%2Fhtml%2Ffullonsms%2FStaticSpamWarning.html&MessageLength=140&MobileNos=$tomobno&Message=$message&Gender=0&FriendName=Your+Friend+Name&ETemplatesId=&TabValue=contacts");
                curl_exec($ch);
                sleep(1);
            }
        }
    }        
    $html = curl_exec($ch);
    echo $html;
?>
スクリプトは 1 つの SMS に対して正常に動作していましたが、for lop とデータベースを追加して$tomobno(携帯電話番号) を動的に設定すると、メッセージの送信が停止しました。問題はそれです :-
データベースに 3 つの携帯電話番号がありますが、SMS が届きません。
(私は数字をエコーしました。スクリプトはそれらすべてを選択しています。問題は CURL コードにあります。)私は CURL の専門家です。助けてください。
(不必要に質問に反対票を投じないでください)