我想把原来用jsp实现的注册登陆功能,用个客户端小程序来实现。jsp的功能是验证成功后由jsp向数据库写入一条记录。所以不涉及senssion等问题。
我的想法:我想用客户端来模拟一个http包给原来的jsp服务器,那样的话服务器端就不用改动了。不知是否可行?具体该用如何实现?
希望能给出更好的想法,或者提供较好的实现方法.
我的想法:我想用客户端来模拟一个http包给原来的jsp服务器,那样的话服务器端就不用改动了。不知是否可行?具体该用如何实现?
希望能给出更好的想法,或者提供较好的实现方法.
http://url?username=aaa&password=bbb
使用?开始Query字段,各个Query字段之间使用&分隔。
但是POST方法我就不会了,比较难,如果服务器端你可以更改的话就方便了,再说只要自己看看对方的提交表单,重新实现一个只有表单的本地网页不也一样么,还更方便呢。
其实用post,就没有必要用delphi写程序了.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, HttpProt;type
TForm1 = class(TForm)
http1: THttpCli;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
const
crlf:string=chr(13)+chr(10);
var
ms,bb:tmemorystream;
buf:string;
begin
ms:=tmemorystream.Create;
bb:=tmemorystream.Create;
bb.LoadFromFile('2.jpg');//文件的数据
bb.Position:=0;
buf:='--7d332066021a';
buf:=buf+crlf+'Content-Disposition: form-data; name="name"'+crlf+crlf+' name'+crlf;
buf:=buf+'--7d332066021a'+crlf;
buf:=buf+'Content-Disposition: form-data; name="password"'+crlf+crlf+' possword'+crlf;
buf:=buf+'--7d332066021a'+crlf;
buf:=buf+'Content-Disposition: form-data; name="FilePath1"; filename="F:\http 上传\2.jpg"'+crlf;
buf:=buf+'Content-Type: image/pjpeg'+crlf+crlf;
ms.WriteBuffer(buf[1],length(buf)); //将头部格式写进去
ms.Position:=ms.Size;
ms.CopyFrom(bb,bb.Size);//读入JPG文件数据
buf:=crlf+'--7d332066021a'+crlf;//分割符
buf:=buf+'--7d332066021a--';//结束符
ms.Position:=ms.Size;
ms.WriteBuffer(buf[1],length(buf));
ms.Position:=0;
http1.ContentTypePost:='multipart/form-data, boundary=7d332066021a';//指定entype
http1.URL:='http://mail.digimaple.com:8080/frameserver/servlet/Upload';
http1.SendStream:=ms;
http1.Post;
ms.Free;
bb.Free;end;end.
模拟向网站发送一张图片和用户名以及密码
请问哪里有httpport for del7的下载?
请问在那里能下载 httpport for del7?
POST /login.jsp HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Referer: http://202.204.112.69
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Host: 202.204.112.69
Content-Length: 87
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=anpN-6Ll8-dc; CNGASSESSION=F4Q3RK9UEDZ6GDXJNZ9Suser=test&pass=test&ip=211.31.171.25&type=1&action=%D6%D0%B6%CF%C1%AC%CD%F8