短信群发只能用循环,不会很慢的。
调用url,这句话不懂是什么意思…

解决方案 »

  1.   

    我看了看Class.SMS.Web_Sender.php,他是使用的fsockopen()函数。大侠们觉得怎么样?如何作?
      

  2.   

    是这样撒,每调用一次url就发送一条消息,并且返回一个值。 如果每次发送都成功,当然不存在问题,但是如果有一些消息发送不成功,(一般来说发送不成功将花费更多的时间),那势必会影响下一次调用url(他将等待前一次消息发送的返回结果)。如果可以使用线程的话,就效率就高多了。每一次发送不必等待其他发送的返回。
      

  3.   

    如果你要群发的话,最好使用其他语言做ISAPI或者CGI程序
      

  4.   

    To taogx(滔滔) , 偶也是这么想。 不过偶们主机是unix,偶不搞。
      

  5.   

    利用ICQ网关发送手机短信
    <? 
    //###########################################################
    // 
    // For questions and comments
    // Roland (alias -=: Vlieg :=-)
    // icq #78354631 
    // mail: [email protected] 
    // 
    // NB: This script won't work on free hosting pages, because of the secure mode! 
    // NB: You must have registered your ICQ# at http://web.icq.com/sms/login/ in order for this script to work
    //########################################################### 
    //****************************************************************\\ 
    //Config: $uin=""; //your ICQ number
    $passw=""; //your ICQpassword$prefix="27"; //sms prefix 
    $phonenumber="0000000"; //sms phone number
    $message = "Hello!"; //sms message
    //****************************************************************\\ 
    // EN: calculate the content length$contentlength= ( 37+ 
    strlen($uin)+ 
    strlen($passw) 
    ); //****************************************************************\\ 
    // Openen van de inlogpagina 
    // EN: open loginpage$htmlreply=""; 
    $post ="POST http://web.icq.com/karma/dologin/1,,,00.html HTTP/1.0 
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* 
    Referer: http://web.icq.com/sms/login/1,,,00.html 
    Accept-Language: nl 
    Content-Type: application/x-www-form-urlencoded 
    Accept-Encoding: gzip, deflate 
    User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) 
    Host: web.icq.com 
    Content-Length: ".$contentlength." 
    Proxy-Connection: Keep-Alive 
    Pragma: no-cache 
    Cookie: uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes; uin=".$uin."; sms_country=".$prefix."; KarmaService1=Yes uService=1&uLogin=".$uin."&uPassword=".$passw."&x=0&y=0"; $remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30); global $remote; 
    global $post; 
    fputs($remote, $post); while (!feof($remote)) { $htmlreply.=fgets($remote,120); } 
    //UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply).""; 
    fclose($remote); //****************************************************************\\ 
    //persoonlijke cookie uit de inlogpage halen 
    // EN: fetch personal cookie from login page$splited = split("\n",$htmlreply); 
    $cookies = $splited[3]; 
    $cookies = str_replace("Set-Cookie: KarmaLogin=","",$cookies); 
    $cookies = str_replace("; path=/","",$cookies); 
    $cookies = str_replace("\n","",$cookies); 
    //UNCOMMENT VOOR OUTPUT: echo $cookies; if (strlen($prefix) == 2) { $contentprefix = ' '.$prefix; } else { $contentprefix = $prefix; } 
    $charcount = (160-strlen($message)); 
    $contentlength= ( 1561+ 
    strlen($message)+ 
    strlen($charcount)+ 
    strlen($phonenumber)+ 
    strlen($prefix) 
    ); //****************************************************************\\ 
    //Verzendpagina openen met de opgehaalde cookie 
    // EN: open send page with fetched cookie$htmlreply=""; 
    $post ='POST http://web.icq.com/sms/send_history/1,,,00.html HTTP/1.0 
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* 
    Referer: http://web.icq.com/sms/send_session...0.html?prefix=+'.$prefix.'&carrier=&tophone='.$phonenumber.' 
    Accept-Language: nl 
    Content-Type: multipart/form-data; boundary=---------------------------7d12442eab4 
    Accept-Encoding: gzip, deflate 
    User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt) 
    Host: web.icq.com 
    Content-Length: '.$contentlength.' 
    Proxy-Connection: Keep-Alive 
    Pragma: no-cache 
    Cookie: uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.'; uin='.$uin.'; sms_country='.$prefix.'; KarmaService1=Yes; KarmaLogin='.$cookies.' -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="carrier" 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="prefix" '.$contentprefix.' 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="tophone" '.$phonenumber.' 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uSession" 1 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uReply" 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uLastId" 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uSend" 1 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uNextId" 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uHistoryCounter" 1 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="count" 0 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="uSubmitCount" 0 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="checkNewMsg" 180000 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="charcount" '.$charcount.' 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="msg" '.$message.' 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="x" 30 
    -----------------------------7d12442eab4 
    Content-Disposition: form-data; name="y" 16 
    -----------------------------7d12442eab4-- 
    '; $remote = fsockopen("web.icq.com", 80, &$errno, &$errstr, 30); global $remote; 
    global $post; 
    fputs($remote, $post); while (!feof($remote)) { $htmlreply.=fgets($remote,120); } 
    //UNCOMMENT FOR OUTPUT: echo "".htmlspecialchars($htmlreply).""; 
    fclose($remote); //****************************************************************\\ 
    // check if message is send if send 'moved permanently' is returned if (eregi('Moved Permanently',$htmlreply)) 

    echo "Sms message successfully sent!"; 
    } else { 
    echo "Sms not sent!"; 

    ?>
      

  6.   

    楼上这位,POST请求FORM的数据格式怎么写?
      

  7.   

    我用php,使用fsockopen(),fputs(), fgets()能实现短信发送了。
      

  8.   

    to fish21cn(阿飞) 
    我用php,使用fsockopen(),fputs(), fgets()能实现短信发送了。
    怎么做?代码
      

  9.   

    看情况,你的那家SP提供的发送短信接口是HTTP协议的。那用fsockopen()发送HTTP请求就是了。相关的方法在网上都可以查到。很简单的。
      

  10.   

    如果接口,返回不是太复杂,可以直接使用fopen$url=http://sms.com/sms.php?send=13913911111&text=sms
    $fp=fopen($url,"rb")
    if ($fp)
    ... // 可读出结果,一般只要成功打开,就能发送吧
    echo "成功";
      

  11.   

    顺便问一下,利用ICQ那个短信发送,是不是两头都不用花钱啊??!!!呵呵
      

  12.   

    楼上疯宝宝和点点心缘都说得对。只是打开socket往里面写数据时需要看看http协议,要自己写http请求。  不复杂。
    function _SplitURL($URL)//要求输入为www.csdn.net/exper/xx格式。不能前面加"http://",用一个正则表达式,我写不出来.
    {
    $Web["Host"] = "";
    $Web["File"] = "";
    preg_match("/[^\/]+/i", $URL, $Matches);
    $Web["Host"] = $Matches[0];
    $Web["File"] = str_replace($Web["Host"], "", $URL);
    return $Web;
    }function _GetData($URL, $GetData, $Port = 80)//往接口发数据的函数
    {
    $Web = _SplitURL($URL);
    $fp = fsockopen ($Web["Host"], $Port, $ErrNo, $ErrStr, 30);
    if (!$fp)
    {
    //$Err["ErrNo"] = $ErrorNo;
    //$Err["ErrStr"] = $ErrStr;
    return false;

    else
    {
    $Web["File"] .= "?";

    for(reset($GetData); $Key = key($GetData); next($GetData))
    $Web["File"] .= $Key."=".$GetData[$Key]."&";

    $Web["File"] = substr($Web["File"], 0, -1);
    $Data = "GET ".$Web["File"]." HTTP/1.0\r\nHost: ".$Web["Host"]."\r\n\r\n"; fputs($fp, $Data);

    while (!feof($fp))
    {
    $Result = (fgets($fp,128));
    $Result = _GetReturn($Result);
    if ($Result > 0)
    return false;
        }
    fclose ($fp);
    }
    }具体使用:接口参数具体看短信服务提供商
    $Params["service"] = $Service;
    $Params["rcv"] = $Mobile;
    $Params["fee"] = $Mobile;
    $Params["snd"] = $SndNo; //
    $Params["msg"] = $Msg;
    _GetData("www.my5757.com/e21cn/sendMt.jsp", $Params);
      

  13.   

    不过偶做的一个广播短消息的PHP脚本,运行起来太慢了。  就是循环调用上面的代码。  不知道有什么好方法没有?