1

タイトルは申し訳ありませんが、どう呼べばいいのかよくわかりません。

phpスクリプトで自動SMSを送信できるssmサービスに登録しています。スクリプトは基本的に、すべてのsmsパラメーター(sendername、..)を使用して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;

ブラウザで直接、SMSが送信されます。

問題は、エラーが発生することです

'/'アプリケーションのサーバーエラー。

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 に答える