新灵感站族管理系统 API接口 (ASP.NET C#)示例下载及代码说明

新灵感 站族网站群管理 系统功能简介:

 

 

  • 1.采 集:使用强大的搜索引擎(已开放新闻搜索,博客搜索),运用关键词采集文章,信息将更加准确.
  • 2.关键词:支持百度风云榜关键词榜单,不用设关键词,也能获取最新热点信息.
  • 3.过 滤:自行开发的HTML页面提取系统,对任意一篇HTML文章页页能够准确提取文章正文.
  • 4.伪原创:我们有一个观点(做到用户能阅读,不影响逻辑,蜘蛛认原创否抄袭,优化效果达到最佳)
  • 5.自 动:定时采集,自定义规则伪原创,自动定时定量上传.以达到蜘蛛实时抓取页面.
  •  

    详细资料请查询 新灵感官网站网站:http://www.xinlg.com/

    站族管理系统登录地址:http://www.zhanzu.net/

     

     

     

    以下是.net(C#)接口的示例 完整版下载

     

    View Code
    using System;
    using System.Collections.Generic;
    using System.Web;
    using System.Data.SqlClient;
    using System.Data;

    namespace zhanzu.net_api_C
    {
        
    /// <summary>
        
    /// zhanzu 的摘要说明
        
    /// </summary>
        public class zhanzu : IHttpHandler
        {

            
    public bool IsReusable
            {
                
    get
                {
                    
    return false;
                }
            }

            
    /// <summary>
            
    /// 你的帐户名称
            
    /// </summary>
            private string _UserName = "xinlg@163.com";

            
    /// <summary>
            
    /// //所设置的站点的密码KEY 请对外保密 在管理系统编辑站点时可获取到。
            
    /// </summary>
            private string _Key = "856A44CFB7E31EBB469767C8589BEB74";

            
    /// <summary>
            
    /// 数据库链接字串 SQL Server
            
    /// </summary>
            private string _ConnectionString = "Data Source=FEI-PC\\SQLEXPRESS;Uid=sa;Pwd=111;database=WanyouRencai";

            
    /// <summary>
            
    /// 用于给返回给服务器信息 0程序出错,或未知 1:成功 2:验证失败 3:数据无效
            
    /// </summary>
            private string _ResultInfo = "";


            
    public void ProcessRequest(HttpContext context)
            {
                
    try
                {
                    Info newInfo 
    = new Info();
                    HttpPost
    <Info>.GetPost(ref newInfo, context.Request.Form);

                    
    if (ValidateUserName(newInfo))
                    {
                        
    if (!string.IsNullOrEmpty(newInfo.Title) &&
                            
    !string.IsNullOrEmpty(newInfo.Keywords) &&
                            
    !string.IsNullOrEmpty(newInfo.Content))
                        {
                            
    //对数据的进一步处理 请在这里处理
                            
                            
    //if (AddContent_3layer(newInfo))
                            
    //    _ResultInfo = "1";

                            
    if (AddContent_Sql(newInfo))
                                _ResultInfo 
    = "1";
                            
    else
                                _ResultInfo 
    = "0";

                        }
                        
    else
                            _ResultInfo 
    = "3";
                    }
                    
    else
                        _ResultInfo 
    = "2";
                    context.Response.Write(_ResultInfo);
                }
                
    catch
                {
                    context.Response.Write(
    "0");
                }


            }

            
    /// <summary>
            
    /// 使用3层架构 添加数据方法 例子
            
    /// </summary>
            
    /// <returns></returns>
            public bool AddContent_3layer(Info info)
            {
                
    try
                {
                    
    //CYLY2009_TopicsModel newModel = new CYLY2009_TopicsModel();
                    
    //newModel.ToPicTitle = info.Title;
                    
    //newModel.Keywords = info.Keywords;
                    
    //newModel.Content = info.Content;
                    
    //newModel.PostUser = info.UserName;
                    
    //newModel.Source = info.Source;
                    
    //newModel.PostTime = DateTime.Now.ToString();
                    
    //if (new CYLY2009_TopicsBLL().add(newModel))
                    
    //{
                    
    //    return true;
                    
    //}
                    
    //else
                    
    //{
                    
    //    return false;
                    
    //}
                    return true;
                }
                
    catch
                {
                    
    return false;
                }
            }

            
    /// <summary>
            
    /// 使用SQL语句 添加数据方法 例子
            
    /// </summary>
            
    /// <param name="info"></param>
            
    /// <returns></returns>
            public bool AddContent_Sql(Info info)
            {
                
    try
                {
                    
    //SqlConnection conn = new SqlConnection(_ConnectionString);
                    
    //conn.Open();

                    
    //string CategoryGid = "";

                    
    ////根据模块分类名称获取站点数据中分类的ID
                    //string select_sql = "select top 1 CategoryGid from CYLY2009_Category where CategoryName like '%" + Cms.SetLanguageCode(HttpUtility.UrlDecode(info.ClassName), Cms.NoLanguageSign) + "%'";
                    
    //SqlDataAdapter Sda = new SqlDataAdapter();
                    
    //DataSet Ds = new DataSet();
                    
    //Sda.SelectCommand = new SqlCommand(select_sql, conn);
                    
    //Sda.Fill(Ds, "db");
                    
    //if (Ds.Tables["db"].Rows.Count == 1)
                    
    //{
                    
    //    CategoryGid = Ds.Tables["db"].Rows[0][0].ToString();
                    
    //}

                    
    ////插入数据SQL
                    //string sql = "INSERT INTO [CYLY2009_Topics]([CategoryGid],[ToPicTitle],[Description],[Keywords],[PostUser],[PostTime])VALUES";
                    
    //sql += "('" + CategoryGid + "','" + Cms.SetLanguageCode(HttpUtility.UrlDecode(info.Title), Cms.NoLanguageSign) + "','" + Cms.SetLanguageCode(HttpUtility.UrlDecode(info.Content), Cms.NoLanguageSign) + "','" + Cms.SetLanguageCode(HttpUtility.UrlDecode(info.Keywords), Cms.NoLanguageSign) + "','" + info.UserName + "','" + DateTime.Now.ToString() + "')";

                    
    //SqlCommand cmd = new SqlCommand(sql, conn);
                    
    //if (cmd.ExecuteNonQuery() > 0)
                    
    //{
                    
    //    conn.Close();
                    
    //    return true;
                    
    //}
                    
    //else
                    
    //{
                    
    //    return false;
                    
    //}
                    return true;
                }
                
    catch
                {
                    
    return false;
                }
            }

            
    /// <summary>
            
    /// 验证用户信息
            
    /// </summary>
            
    /// <param name="info"></param>
            
    /// <returns></returns>
            public bool ValidateUserName(Info info)
            {
                
    try
                {
                    
    if (info.Key == System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(_Key, "MD5"&&
                        info.UserName 
    == _UserName)
                        
    return true;
                    
    return false;
                }
                
    catch
                {
                    
    return false;
                }
            }


        }

        
    /// <summary>
        
    /// 用于取值
        
    /// </summary>
        
    /// <typeparam name="T"></typeparam>
        public static class HttpPost<T> where T : new()
        {
            
    /// <summary>    
            
    /// 为实体类赋值    
            
    /// </summary>    
            
    /// <typeparam name="T">Model</typeparam>    
            
    /// <param name="t">model</param>    
            
    /// <param name="form">Request</param>    
            
    /// <returns></returns>    
            public static int GetPost<T>(ref T t, System.Collections.Specialized.NameValueCollection form)
            {
                
    int va = 0;
                Type type 
    = t.GetType();//获取类型    
                System.Reflection.PropertyInfo[] pi = type.GetProperties();//获取属性集合    
                foreach (System.Reflection.PropertyInfo p in pi)
                {
                    
    if (form[p.Name] != null)
                    {
                        
    try
                        {
                            p.SetValue(t, Convert.ChangeType(form[p.Name], p.PropertyType), 
    null);
                            va
    ++;
                        }
                        
    catch
                        {
                        }
                    }
                }
                
    return va;
            }

        }

        
    /// <summary>
        
    /// 获取数据实体
        
    /// </summary>
        public class Info
        {
            
    private string _Title = null;
            
    private string _Keywords = null;
            
    private string _Content = null;
            
    private string _Source = null;
            
    private string _ClassName = null;
            
    private string _UserName = null;
            
    private string _Key = null;

            
    /// <summary>
            
    /// 接收标题
            
    /// </summary>
            public string Title { set { _Title = value; } get { return _Title; } }

            
    /// <summary>
            
    /// 接收关键词
            
    /// </summary>
            public string Keywords { set { _Keywords = value; } get { return _Keywords; } }

            
    /// <summary>
            
    /// 文章正文
            
    /// </summary>
            public string Content { set { _Content = value; } get { return _Content; } }

            
    /// <summary>
            
    /// 文章来源 原文URL地址
            
    /// </summary>
            public string Source { set { _Source = value; } get { return _Source; } }

            
    /// <summary>
            
    /// 分类名称 即管理系统的模块名称
            
    /// </summary>
            public string ClassName { set { _ClassName = value; } get { return _ClassName; } }

            
    /// <summary>
            
    /// 接收帐户名 用于验证
            
    /// </summary>
            public string UserName { set { _UserName = value; } get { return _UserName; } }

            
    /// <summary>
            
    /// 接收密钥匙 已MD5加密 用于验证
            
    /// </summary>
            public string Key { set { _Key = value; } get { return _Key; } }

        }

    }

     

     更多的详细资料请参考 :

     

    新灵感站族系统接口使用方式以及参数说明文档

    http://www.xinlg.com/support/show/41.html

    posted on 2011-08-16 15:54  cestarme  阅读(778)  评论(0编辑  收藏  举报