• 大小: 840KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: C#
  • 标签: C#  

资源简介

通过Http请求,对网站进行数据抓取,以及操控

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.Web;

namespace DnspodApp
{
    public class DnspodHelp
    {
        string cookie = ““;
        HttpHelper hh = new HttpHelper();

        public bool Login(string username string pwd)
        {
            username.Replace(“@“ “%40“);
            HttpItem hitem = new HttpItem
            {
                Method = “POST“
                URL = “https://www.dnspod.cn/Auth/Login“
                ContentType = “application/x-www-form-urlencoded“
                Postdata = string.Format(“email={0}&password={1}&multilogin=f“ username pwd)
            };
            var r = hh.GetHtml(hitem);
            cookie = r.Cookie;
            if (r.Html.IndexOf(“success“) == -1)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

        public bool AddDomain(string domain)
        {
            var r = hh.GetHtml(new HttpItem
               {
                   Method = “POST“
                   URL = “https://www.dnspod.cn/Api/Domain.Create“
                   ContentType = “application/x-www-form-urlencoded“
                   Postdata = string.Format(“format=json&lang=cn&error_on_empty=no&use_session=yes&domain={0}&group_id=1&is_mark=no“ domain)
                   Cookie = cookie
               });

            if (r.Html.IndexOf(“code\“:\“1\““) != -1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public string GetDomainID(string domain)
        {

            var r = hh.GetHtml(new HttpItem
             {
                 Method = “POST“
                 URL = “https://www.dnspod.cn/Api/Domain.Info“
                 ContentType = “application/x-www-form-urlencoded“
                 Postdata = string.Format(“domain={0}&format=json&lang=cn&error_on_empty=no“ domain)
                 Cookie = cookie
             });

            var firstIndex = r.Html.IndexOf(“domain\“:{\“id\“:\““);
            if (firstIndex == -1)
            {
                return “-1“;
            }
            var templ = “domain\“:{\“id\“:\““.Length;
            var re = r.Html.Substring(firstIndex + templ r.Html.IndexOf(“\““ firstIndex) - firstIndex - templ);
            return re;
        }


        public bool AddRecord(string domainid string domain string record_type string value string sub_domain)
        {
            sub_domain = HttpUtility.UrlEncode(sub_domain);
            var r = hh.GetHtml(new HttpItem
             {
                 Method = “POST“
                 URL = “https://www.dnspod.cn/Api/Record.Create“
                 ContentType = “application/x-www-form-urlencoded“
                 Postdata = string.Format(“domain_id={0}&domain_g

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\app.config

     文件      48128  2014-08-22 11:17  DnspodApp\DnspodApp\bin\Debug\DnspodApp.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\Debug\DnspodApp.exe.config

     文件      77312  2014-08-22 11:17  DnspodApp\DnspodApp\bin\Debug\DnspodApp.pdb

     文件      11600  2014-08-27 17:19  DnspodApp\DnspodApp\bin\Debug\DnspodApp.vshost.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\Debug\DnspodApp.vshost.exe.config

     文件        490  2010-03-17 22:39  DnspodApp\DnspodApp\bin\Debug\DnspodApp.vshost.exe.manifest

     文件     335360  2014-08-22 11:17  DnspodApp\DnspodApp\bin\Debug\Newtonsoft.Json.dll

     文件      46080  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.exe.config

     文件      69120  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.pdb

     文件      11600  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.vshost.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.vshost.exe.config

     文件        490  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\DnspodApp.vshost.exe.manifest

     文件     335360  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加\Newtonsoft.Json.dll

     文件     156617  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加.rar

     文件      48128  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.exe.config

     文件      69120  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.pdb

     文件      11600  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.vshost.exe

     文件        144  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.vshost.exe.config

     文件        490  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\DnspodApp.vshost.exe.manifest

     文件     335360  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版\Newtonsoft.Json.dll

     文件     157560  2014-08-22 11:17  DnspodApp\DnspodApp\bin\域名添加12-21过期-简化版.rar

     文件       4437  2014-08-22 11:17  DnspodApp\DnspodApp\DnspodApp.csproj

     文件       6507  2014-08-26 08:46  DnspodApp\DnspodApp\DnspodHelp.cs

     文件      13046  2014-08-22 11:17  DnspodApp\DnspodApp\Form1.cs

     文件      14261  2014-08-22 11:17  DnspodApp\DnspodApp\Form1.Designer.cs

     文件       5817  2014-08-22 11:17  DnspodApp\DnspodApp\Form1.resx

     文件      11292  2014-08-22 14:10  DnspodApp\DnspodApp\Form2.cs

............此处省略37个文件信息

评论

共有 条评论