当前位置:首页
开发技术指南» 文章正文
    引言:

 ·高分用例的划分    »显示摘要«
    摘要: 请教各位高手用例的划分: 现在我有一个教案通,它就是帮助老师做电子教案,老师做好了的教案可以上传到服务器,老师把他的教案上传之后发布就能让所有共享使用,但不发布其他老师是看不到的。老师也可以下载已发布的教案;老师能够在教案库中搜索教案;还有就是老师拥有他做教案用的素材库,同时他可以维护他上传的教案。 我就是把它分为了:制作教案、上传教案、下载教案、维护教案、搜索教案和维护个人素材库几个用例......
 ·idispatch error #3105    »显示摘要«
    摘要: try { if(!m_precordset->supports(adaddnew)) afxmessagebox("dont support addnew!"); m_precordset->addnew(); //主叫号码 m_precordset->fields->getitem(_variant_t("r......


如何用httpWebRequest自动注册,并填写图片识别码

如何用httpWebRequest自动注册,并填写图片识别码

NO.1   作者: 2066

一、图片识别码  
    Dim   httpReq   As   System.Net.HttpWebRequest  
                  Dim   httpResp   As   System.Net.HttpWebResponse  
                  Dim   strBuff   As   String  
                  Dim   httpURL   As   New   System.Uri("http://yourUrl.img.php?str=46203")       这是识别码图片的地址,你要换成你的地址  
                  httpReq   =   CType(WebRequest.Create(httpURL),   HttpWebRequest)  
                  httpResp   =   CType(httpReq.GetResponse(),   HttpWebResponse)  
                  httpReq.KeepAlive   =   True        保持链接,你就一直可以用这个识别码了  
                  strBuff   =   "CharacterSet:   "   &   httpResp.CharacterSet.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "ContentEncoding:   "   &   httpResp.ContentEncoding.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "ContentLength:   "   &   httpResp.ContentLength.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "ContentType:   "   &   httpResp.ContentType.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "LastModified:   "   &   httpResp.LastModified.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "Method:   "   &   httpResp.Method.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "ProtocolVersion:   "   &   httpResp.ProtocolVersion.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "ResponseUri:   "   &   httpResp.ResponseUri.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "Server:   "   &   httpResp.Server.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "StatusCode:   "   &   httpResp.StatusCode.ToString   &   ControlChars.CrLf  
                  strBuff   =   strBuff   &   "StatusDescription:   "   &   httpResp.StatusDescription.ToString   &   ControlChars.CrLf  
                  httpReq.Method   =   "GET"  
                  MsgBox(strBuff)  
   
   
  二、自动注册  
    Dim   httpUrl2   As   New   System.Uri("http://yourUrl/cgi-bbs/signup.cgi?"   &   "bookname=1&regid=1&str=1&userid=459&password=1&confirm=1&username=1&cardnumber=1")     在地址后挂上你要注册的信息,什么用户名密码什么的  
                  Dim   req   As   HttpWebRequest  
                  req.Timeout   =   10000     超时5秒  
                  req   =   CType(WebRequest.Create(httpUrl2),   HttpWebRequest)  
                  req.Method   =   "POST"        
                  req.ContentType   =   "application/x-www-form-urlencoded"   ’这句一定要  
                  Dim   bytesData()   As   Byte   =   System.Text.Encoding.ASCII.GetBytes("bookname=1&regid=1&str=1&userid=459&password=1&confirm=1&username=1&cardnumber=1")   ‘把注册信息转换在字节  
                  req.ContentLength   =   bytesData.Length    ’注册信息的长度  
                  Dim   postStream   As   Stream   =   req.GetRequestStream()  
                  postStream.Write(bytesData,   0,   bytesData.Length)  
                  postStream.Close()  
   
                  Dim   res   As   HttpWebResponse   =   CType(req.GetResponse(),   HttpWebResponse)  
                  MsgBox(res.StatusCode.ToString)  
                  Dim   enc   As   Encoding   =   System.Text.Encoding.GetEncoding("GB2312")  
                  Dim   sPostData   As   String   =   "content="   &   HttpUtility.UrlEncode(sContent,   enc)   &   "&name="   &   HttpUtility.UrlEncode(sName,   enc)  ‘如果有中文的内容,可能要用到这句  
   
   
 


 ·用javascript如何解析字符串    »显示摘要«
    摘要: 比如我想分别提取出字符串 "aaa|bbb|ccc" 中的"aaa","bbb","ccc",在javascript里有相应的函数干这事吗? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE