淘宝登陆
来源:互联网 发布:java双引号转义字符 编辑:程序博客网 时间:2024/04/30 13:39
public static string getSaleInfo(string User, string psw, string VCode, int myIndex) { string tmpUser = myEncoding(User, 1); string tmpPsw = psw; string tmpVCode = VCode; if (tmpToken == "") return "初始化登录失败"; string strData = string.Format("TPL_username={0}&TPL_password={1}"+ "&action=Authenticator&event_submit_do_login=anything&TPL_redirect_url=http%3A%2F%2Fwww.taobao.com&from=tb&fc=2&style=" + "default&css_style=&tid=XOR_1_000000000000000000000000000000_6358305443087C737B03067F" + "&support=000001&CtrlVersion=1%2C0%2C0%2C7&loginType=3&minititle=&minipara=&pstrong=1&longLogin=-1&llnick=" + "&sign=&need_sign=&isIgnore=&popid=&callback=&guf=¬_duplite_str=&need_user_id=&poy=&gvfdcname=10&" + "from_encoding=TPL_username={0}&TPL_password={1}&_tb_token_={2}&action=Authenticator&" + "event_submit_do_login=anything&TPL_redirect_url=http%3A%2F%2Fwww.taobao.com%2F&from=tb&fc=2&style=default&css_style=&tid=XOR_1_000000000000000000000000000000_6358305443087C737B03067F" + "&support=000001&CtrlVersion=1%2C0%2C0%2C7&loginType=3&minititle=&minipara=&pstrong=1&longLogin=-1&llnick=&sign=&need_sign=&isIgnore=&popid=&callback=&guf=" + "¬_duplite_str=&need_user_id=&poy=&gvfdcname=10&from_encoding=", tmpUser, tmpPsw, tmpToken); //string strData = string.Format("TPL_username={0}&TPL_password={1}&_tb_token_={2}&action=Authenticator&event_submit_do_login=anything&TPL_redirect_url=http%3A%2F%2Fwww.taobao.com%2F&from=tb&fc=2&style=default&css_style=&tid=XOR_1_000000000000000000000000000000_6358305443087C737B03067F&support=000001&CtrlVersion=1%2C0%2C0%2C7&loginType=3&minititle=&minipara=&pstrong=2&longLogin=-1&llnick=&sign=&need_sign=&isIgnore=&popid=&callback=&guf=¬_duplite_str=&need_user_id=&poy=&gvfdcname=10&from_encoding=" // ,tmpUser,tmpPsw,tmpToken); string strUrl1 = "https://login.taobao.com/member/login.jhtml";//?redirect_url=http%3A%2F%2Fwww.taobao.com%2F";//此处链接换了就not Ok了. string tmpStr = Execute(strUrl1, "post", strData, "gb2312"); //getComplain 注意与其它url的顺序 tmpStr = Execute(strUrl, "get", "", "gb2312"); int iComplain = 0; string tmpComplain = myMatch(tmpStr, "(?<=收到投诉\\(<em>).*(?=</em>\\))", 0); try { iComplain = int.Parse(tmpComplain); } catch { } //strUrl = "http://jianghu.taobao.com/admin/home.htm"; //tmpStr = Execute(strUrl, "get", "", "gb2312"); //I'm seller strUrl = "http://i.taobao.com/my_taobao.htm?seller=true"; tmpStr = Execute(strUrl, "get", "", "gb2312"); string tmpWaitSend = myMatch(tmpStr, "(?<=>待发货订单\\(<em>).*(?=</em>\\))", 0); string tmpRefunding = myMatch(tmpStr, "(?<=>退款中订单\\(<em>).*(?=</em>\\))", 0); int iRefunding = 0; int iWaitSend = 0; try { iWaitSend = int.Parse(tmpWaitSend); } catch { } try { iRefunding = int.Parse(tmpRefunding); } catch {
} app.myReport[myIndex].User = User; app.myReport[myIndex].iWaitSend = iWaitSend; app.myReport[myIndex].iExitFund = iRefunding; app.myReport[myIndex].iCompain = iComplain; //nekot=g%2C27nmtugg5s62fnpk1297864546431 // System.Diagnostics.Debug.Print(tmpStr); return "getOK"; }
向某网址Post信息,并得到CookieContainer以便以后直接通过验证
using System;using System.Net;using System.IO;using System.Text;class Test{ [STAThread] static void Main(string[] args) { // // TODO: 在此处添加代码以启动应用程序 // string url = "http://localhost/csdn2/1.asp"; // <% // if request("aa")="zhuye" then session("ok")="ok" // if session("ok")="ok" then // response.write("登录") // else // response.write("没有登录") // end if // %> string indata = "aa=zhuye"; string outdata = ""; CookieContainer myCookieContainer = new CookieContainer(); //新建一个CookieContainer来存放Cookie集合 HttpWebRequest myHttpWebRequest = (HttpWebRequest) WebRequest.Create(url); //新建一个HttpWebRequest myHttpWebRequest.ContentType = "application/x-www-form-urlencoded"; myHttpWebRequest.ContentLength = indata.Length; myHttpWebRequest.Method = "POST"; myHttpWebRequest.CookieContainer = myCookieContainer; //设置HttpWebRequest的CookieContainer为刚才建立的那个myCookieContainer Stream myRequestStream = myHttpWebRequest.GetRequestStream(); StreamWriter myStreamWriter = new StreamWriter(myRequestStream, Encoding.GetEncoding("gb2312")); myStreamWriter.Write(indata); //把数据写入HttpWebRequest的Request流 myStreamWriter.Close(); myRequestStream.Close(); //关闭打开对象 HttpWebResponse myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse(); //新建一个HttpWebResponse myHttpWebResponse.Cookies = myCookieContainer.GetCookies(myHttpWebRequest.RequestUri); //获取一个包含url的Cookie集合的CookieCollection Stream myResponseStream = myHttpWebResponse.GetResponseStream(); StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("gb2312")); outdata = myStreamReader.ReadToEnd(); //把数据从HttpWebResponse的Response流中读出 myStreamReader.Close(); myResponseStream.Close(); Console.WriteLine(outdata); //显示"登录" //拿到了Cookie,再进行请求就能直接读取到登录后的内容了 myHttpWebRequest = (HttpWebRequest) WebRequest.Create(url); myHttpWebRequest.CookieContainer = myCookieContainer;//* //刚才那个CookieContainer已经存有了Cookie,把它附加到HttpWebRequest中则能直接通过验证 myHttpWebResponse = (HttpWebResponse) myHttpWebRequest.GetResponse(); myHttpWebResponse.Cookies = myCookieContainer.GetCookies(myHttpWebRequest.RequestUri); myResponseStream = myHttpWebResponse.GetResponseStream(); myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("gb2312")); outdata = myStreamReader.ReadToEnd(); myStreamReader.Close(); myResponseStream.Close(); Console.WriteLine(outdata); //再次显示"登录" //如果把*行注释调,就显示"没有登录" } }
- 淘宝登陆
- android 淘宝登陆授权
- 用idhttp登陆淘宝网站
- selenium、python模拟登陆淘宝
- php淘宝联合登陆怎么做?
- ecshop 实现qq,新浪,淘宝登陆接口
- selenium 淘宝登陆购买,基础实现
- python+selenium+phantomjs 模拟淘宝登陆
- php 模拟登录淘宝taobao阿里妈妈|模拟登录淘宝联盟|curl模拟登录淘宝|模拟登陆淘宝采集数据
- 淘宝网登陆时密码输不进去??
- android平台下,淘宝客户端开发之——登陆
- 使用nodejs模拟淘宝登陆,仅供参考,未处理验证码
- 菜鸟学web---类似淘宝的登陆界面
- 天猫淘宝登陆页面无限循环 解决办法
- Python+Selenium 持续化传递Cookie登陆淘宝 实践
- 淘宝网或阿里巴巴模拟登陆获取数据
- 淘宝
- 淘宝
- 链表中倒数第k个结点
- Linux shell的sar工具
- 【汇编】 汇编程序设计中的英文缩写
- VMware环境下,在RHEL5上安装oracle10g图文版
- 基础备忘:带参数的main 函数
- 淘宝登陆
- C/C++浮点数在内存中是怎么存储的?
- VC++程序运行时出现Runtime error的一种情况及解决
- HDU 4370 0 or 1
- 持久化订单生成
- Canvas类和Paint的绘制机器人
- Oracle SQL语句调优(一)
- 今儿先给开个头儿
- 悟透JavaScript之原型扩展 ---(1)