日期:2014-05-17  浏览次数:20996 次

winform模拟至phpwind论坛发帖,提示[非法请求,请返回重试!] 如何处理?


我提交的参数:


string A = "这是第一个帖子";
string B = "这是第一个帖子的内容";//方便起见,一下每个参数隔开
string.Format(";
agicname=;
&magicid=;
&verify=87188a1f;
&cyid=0;
&ajax=1;
&iscontinue=0;
&atc_title={0};
&usernames=;
&atc_tags=;
&atc_money=0;
&atc_rvrc=0;
&replyrewardcredit=money;
&replyreward[replyrewardnum]=;
&replyreward[replyrewardtimes]=;
&replyreward[replyrewardreptimes]=1;
&replyreward[replyrewardchance]=10;
&atc_usesign=1&atc_autourl=1;
&atc_convert=1;
&step=2;
&pid=;
&action=new;
&fid=42;
&tid=0;
&article=0;
&special=0;
&_hexie=7b87286f;
&atc_content={1}", A, B);
  string form = Http.PostHtml("http://bbs.eyuyao.com/post.php?fid=42#breadCrumb", post, ref cookie, Encoding.GetEncoding("gb2312"));//提交后提示:非法请求,请返回重试


发帖状态页面:只要填入标题、内容,就直接发帖既可。

atc_content={1} 这个是我自己加上去的,因为在抓包结果上发现,没有内容提交参数。

------解决方案--------------------


    [self.textViewContent resignFirstResponder];
    NSString *urlString = [NSString stringWithFormat:@"http://bbs.csdn.net/posts?topic_id=%@",self.topicId];
    ASIFormDataRequest *requestForm = [[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
    requestForm.delegate = self;
    
    
    [requestForm setPostValue:self.textViewContent.text forKey:@"post[body]"];
    [requestForm startAsynchronous];

------解决方案--------------------

       //cookie.Expires = DateTime.Now.AddYears(1);
  

            string url = "https://passport.csdn.net/ajax/accounthandler.ashx";
            string postData = "t=log&u=用户命&p=密码&remember=0&f=b&rand=0.1";
            string loginResult = SendDataByGET(url, postData, ref cookieContainer);

             string aaaaa = UrlEncode("Test Post");