Php GET方法导致错误

Php GET方法导致错误,php,get,ashx,Php,Get,Ashx,对不起,这个标题,但我真的不知道怎么称呼它 我注册了一个ssm服务,它可以使用php脚本自动发送短信。 该脚本基本上构建了一个包含所有sms参数(sendername,…)的xml字符串 然后,它使用此命令发送: $sms_host = "api.inforu.co.il"; // Application server's URL; $sms_port = 80; // Application server's PORT; ////.... generating quer

对不起,这个标题,但我真的不知道怎么称呼它

我注册了一个ssm服务,它可以使用php脚本自动发送短信。 该脚本基本上构建了一个包含所有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); 
直接在浏览器中,然后发送短信

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

“/”应用程序中出现服务器错误

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

您必须手动创建您的
$query
,如果您将其粘贴到浏览器,浏览器将为您编码,但当您处理套接字时,您必须自己进行编码。

如果启用了
允许url\u fopen
,只需使用即可,而不是手动创建HTTP请求<代码>$retval=文件获取内容(“http://api.inforu.co.il/SendMessageXml.ashx?“$查询)我对它进行了URL编码-$query='InforuXML='。urlencode('.$sms\U用户'.$sms\U密码'.')。$message_text.urlencode('.$recepients.'>'.$sms_sender_name.'.$sms_sender_num.'.$customer_parameter.');
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