post后404错误 ( 积分: 200 )

  • 主题发起人 主题发起人 huhuc
  • 开始时间 开始时间
H

huhuc

Unregistered / Unconfirmed
GUEST, unregistred user!
在http://www.sipo.gov.cn/sipo/zljs/default.htm
随便填一个字段然后提交
可以正常返回检索结果页面页面
用WSE抓包如下
POST /sipoasp/zljs/hyjs-jieguo.asp?flag3=1 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.sipo.gov.cn/sipo/zljs/default.htm
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; Maxthon)
Host: 211.157.104.67
Content-Length: 285
Connection: Keep-Alive
Cache-Control: no-cache

selectbase=0&recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143=&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28virus%29+

用 indy模拟此过程

procedure TForm1.Button1Click(Sender: TObject);
var
strMsg,str:string;
sParams: TStringStream;
begin
sParams := TStringStream.create('');
memo1.Text:=IdHTTP1.get('http://www.sipo.gov.cn/sipo/zljs/default.htm');
try
sParams.WriteString('recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12+=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143='+'&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28adcd%29+') ;
strMsg:=IdHTTP1.post('http://www.sipo.gov.cn/sipoasp/zljs/hyjs-jieguo.asp?flag3=1',sParams) ;
memo1.Text:=strmsg;
finally
sParams.Free ;
end;
end;
却出现404错误
用WSE抓包,发现我的程序发了两个包
第一个包
POST /sipoasp/zljs/hyjs-jieguo.asp?flag3=1 HTTP/1.0
Connection: keep-alive
Content-Type: text/html
Content-Length: 285
Host: www.sipo.gov.cn
Accept: text/html, */*
User-Agent: Mozilla/3.0 (compatible; Indy Library)

第二个包
selectbase=0&recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143=&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28virus%29+
请问为什么会这样,或者怎样才能获得检索结果页面
 
在http://www.sipo.gov.cn/sipo/zljs/default.htm
随便填一个字段然后提交
可以正常返回检索结果页面页面
用WSE抓包如下
POST /sipoasp/zljs/hyjs-jieguo.asp?flag3=1 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.sipo.gov.cn/sipo/zljs/default.htm
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; Maxthon)
Host: 211.157.104.67
Content-Length: 285
Connection: Keep-Alive
Cache-Control: no-cache

selectbase=0&recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143=&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28virus%29+

用 indy模拟此过程

procedure TForm1.Button1Click(Sender: TObject);
var
strMsg,str:string;
sParams: TStringStream;
begin
sParams := TStringStream.create('');
memo1.Text:=IdHTTP1.get('http://www.sipo.gov.cn/sipo/zljs/default.htm');
try
sParams.WriteString('recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12+=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143='+'&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28adcd%29+') ;
strMsg:=IdHTTP1.post('http://www.sipo.gov.cn/sipoasp/zljs/hyjs-jieguo.asp?flag3=1',sParams) ;
memo1.Text:=strmsg;
finally
sParams.Free ;
end;
end;
却出现404错误
用WSE抓包,发现我的程序发了两个包
第一个包
POST /sipoasp/zljs/hyjs-jieguo.asp?flag3=1 HTTP/1.0
Connection: keep-alive
Content-Type: text/html
Content-Length: 285
Host: www.sipo.gov.cn
Accept: text/html, */*
User-Agent: Mozilla/3.0 (compatible; Indy Library)

第二个包
selectbase=0&recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143=&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28virus%29+
请问为什么会这样,或者怎样才能获得检索结果页面
 
procedure TForm1.Button1Click(Sender: TObject);
var
sParams: TStringStream;
strMsg:string;
begin
sParams := TStringStream.create('recshu=10&textfield3=&textfield9=virus&textfield10=&textfield12+=&textfield4=&textfield5=&textfield2=&textfield11=&textfield6=&textfield7=&textfield8=&gjgb=&textfield13=&textfield141=&textfield142=&textfield143='+'&submit1=%C8%B7++%B6%A8&searchword=%C3%FB%B3%C6%3D%28adcd%29+');
try
Self.IdHTTP1.HandleRedirects := True;
Self.IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
strMsg:=IdHTTP1.post('http://211.157.104.67/sipoasp/zljs/hyjs-jieguo.asp?flag3=1',sParams) ;
memo1.Text:=strmsg;
finally
sParams.Free ;
end;
end;
 
东兰梦舞,你好,感谢你的帮助,帮我解决了困扰多日的问题。
 
后退
顶部