1

对不起标题,但我不确定如何称呼它。

我已注册到 ssm 服务,该服务可以使用 php 脚本发送自动短信。该脚本基本上使用所有 sms 参数(发件人名称,..)构建一个 xml 字符串。

然后它使用它来发送它:

$sms_host = "api.inforu.co.il"; // Application server's URL;  
    $sms_port = 80; // Application server's PORT; 

    ////.... generating query 
    $sms_path = "/SendMessageXml.ashx"; // Application server's PATH; 
    $fp = fsockopen($sms_host, $sms_port, $errno, $errstr, 30); // Opens a socket to the Application server
    if (!$fp){ // Verifies that the socket has been opened and sending the message; 
        echo "$errstr ($errno)<br />\n"; 
        echo "no error";
    } else  {
        $out = "GET $sms_path?$query HTTP/1.1\r\n";
        $out .= "Host: $sms_host\r\n";
        $out .= "Connection: Close\r\n\r\n";

        fwrite($fp, $out);
        while (!feof($fp)){ 
            echo fgets($fp, 128); 
        } 
        fclose($fp); 

如果我粘贴这个查询很好

$url = "http://api.inforu.co.il/SendMessageXml.ashx?" . $query;

直接在浏览器中,然后发送短信。

所以问题是我遇到了一个错误

“/”应用程序中的服务器错误。

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /SendMessageXml.ashx
4

1 回答 1

0

你必须urlencode()你的$query,如果你把它粘贴到浏览器,浏览器会为你编码,但是当你处理一个套接字时,你必须自己做。

于 2012-06-10T14:07:14.600 回答