Home > Back-end >  Idhttp submitted a HTTP/1.1 405 method not allowed (xe, indy10)
Idhttp submitted a HTTP/1.1 405 method not allowed (xe, indy10)

Time:10-10

I use idhttp login a HTTPS website, mainly as follows:
IdHTTP1. AllowCookies:=False;
IdHTTP1. ReadTimeout:=20000;
IdHTTP1. Request. Host:='upay.10010.com'.
//setting cookies, I is to use webbrower first access to the login page cookie, a verification code also got,
IdHTTP1. Request. CustomHeaders. Text:='cookies: + WebBrowser1. OleObject. Document. Cookies;
IdHTTP1. Request. Referer:='https://upay.10010.com/web/BankCharge/BankChargeInit';//request route
IdHTTP1. Request. AcceptEncoding:='gzip, deflate';
IdHTTP1. Request. AcceptLanguage:='useful - cn, utf-8; Q=0.5 ';
IdHTTP1. Request. Accept:='image/GIF image/x - xbitmap, image/jpeg image/pjpeg,'
+ 'application/x - the rest - flash, application/x - ms - application,'
+ 'application/x - ms - xbap application/VND. Ms - xpsdocument, application/xaml + XML, application/VND. - ms excel, application/VND. Ms powerpoint, application/msword, */*';//receive
IdHTTP1. Request. UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; '
+ 'SV1; EmbeddedWB from 14.52: http://www.bsalsa.com/EmbeddedWB 14.52; '
+ 'the.net CLR 2.0.50727; The.net CLR 3.0.04506.648; The.net CLR 3.5.21022; InfoPath. 2) ';
IdHTTP1. Request. ContentType:='application/x - WWW - form - urlencoded';//receive content type

IdHTTP1. AllowCookies:=True;

//build information data, press caught format fill out
PfData:=TStringList. Create;
Response:=';
Try
PfData. The Clear;

PfData. The Add (+ secstate secstate. State=);//page state values
PfData. Add (' bankChargeBean. PayFee=20//should pay the amount of actual amount
PfData. Add (' bankChargeBean.cardValue=https://bbs.csdn.net/topics/2000 ');//card value
PfData. Add (' bankChargeBean. CardValueCode=01);//value code 01
PfData. Add (' bankChargeBean. UserTel=13166731126 ');//'+ LVCZ. Items [0]. SubItems [1]);//phone
PfData. Add (' bankChargeBean. RegionCode=');
PfData. Add (' bankChargeBean.net Type=01);//
//20 yuan card
PfData. Add (' cardValueHidden=2000 ');//value
PfData. Add (' cardValCodeHidden=01);//code
PfData. Add (' offerPriceStrHidden=19.70).//the actual amount
//30 yuan card
PfData. Add (' cardValueHidden=3000 ');
PfData. Add (' cardValCodeHidden=02 ');
PfData. Add (' offerPriceStrHidden=29.55).
//50 yuan card
PfData. Add (' cardValueHidden=5000 ');
PfData. Add (' cardValCodeHidden=3);
PfData. Add (' offerPriceStrHidden=49.25).
//100 yuan card
PfData. Add (' cardValueHidden=10000 ');
PfData. Add (' cardValCodeHidden=4 ');
PfData. Add (' offerPriceStrHidden=98.50).
//300 yuan card
PfData. Add (' cardValueHidden=30000 ');
PfData. Add (' cardValCodeHidden=5 ');
PfData. Add (' offerPriceStrHidden=295.50).

PfData. Add (' numbean.userNumBean.net Type=');
PfData. Add (' numbean. UserNumBean. RegionCode=');
PfData. Add (' numbean. UserNumBean. UserSelNum=1);
PfData. Add (' numbean. UserNumBean. OtherNum=13166731126 ');//phone number
PfData. The Add (+ vfcode verifyCode=);//captcha
PfData. Add (' numbean. CityCodeBean. ProvinceId=');
PfData. Add (' numbean. CityCodeBean. CityId=');
CardValCodeHidden PfData. Add ('=');
PfData. Add (' numbean. CityCodeBean. CityCode=');
PfData. Add (' numbean. UserNumBean. TelNum=');

Datastr:=TStringStream. Create (");
//PfData. The Add (+ RMB_20 czMoney=);
IdHTTP1. Post (POSTURL_BANKAPPLY PfData, datastr);//here to the abnormal HTTP/1.1 405's current post method does not allow, but intercept package is so of the submitted,
Datastr. Free;
The great god help have a look.

CodePudding user response:

Add POSTURL_BANKAPPLY is' https://upay.10010.com/web/BankCharge/BankChargeApply.action '.

CodePudding user response:

Idhttp1 implementation has been initialized
IdHTTP1. ReadTimeout:=30000;//timeout
IdHTTP1. HandleRedirects:=True;//support redirect
IdHTTP1. Request. CacheControl:='no - cache;//no cache
IdHTTP1. Request. AcceptEncoding:=';//'gzip, deflatee'; Compressed format, if you don't need, just empty
IdHTTP1. Request. Host:=HOSTURL;//host url
IdHTTP1. HTTPOptions:=IdHTTP1. HTTPOptions + [hoKeepOrigProtocol];//set protocol
IdHTTP1. ProtocolVersion:=pv1_1;
IdHTTP1. Request. Connection:='Keep - the Alive;
  • Related