首页 > 代码库 > 查询短信的短信剩余条数

查询短信的短信剩余条数

/**
     * 查询短信的短信剩余条数
     * @return
     */
    public static String getSmsCount() {
        String ret_str = "";
        BufferedReader rd=null;
        try {
            //http://221.179.180.158:9000/QxtSms/QxtFirewall?OperID=test&OperPass=test&SendTime=&ValidTime=&AppendID=1234&DesMobile=13900000000&Content=%D6%D0%CE%C4%B6%CC%D0%C5abc&ContentType=15
           String myurl="http://221.179.180.158:9001/QxtSms/surplus?OperID="+getPropertiesByKey("sms_userId")
           +"&OperPass="+getPropertiesByKey("sms_password");
        /*      String myurl=getPropertiesByKey("sms_get")+"?OperID="+
              getPropertiesByKey("sms_userId")+"&OperPass="+getPropertiesByKey("sms_password")
              +"&SendTime=&ValidTime=&AppendID=&DesMobile="+mobile_phone+"&Content="+ URLEncoder.encode(msg, "GBK")+"&ContentType=15";
        */      
         System.out.println(myurl);
          URL url = new URL(myurl);
          URLConnection conn = url.openConnection();
          conn.setDoOutput(true);
        // Get the response
            rd = new BufferedReader(new InputStreamReader(conn.
              getInputStream()));
          String line;
          while ( (line = rd.readLine()) != null) {
              ret_str += line;
          }
          System.out.println("条数:"+ret_str);
          rd.close();
        }
        catch (Exception e) {
          System.out.println(e.toString());
        }
        finally{
            try {
                if(rd!=null)
                  rd.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        return ret_str;
         
    }