Home > Back-end >  Idhttp login page
Idhttp login page

Time:10-28

Procedure TForm1. Button1Click (Sender: TObject);
Var
PostList: TStrings;
Response: TStringStream;

The begin.
Response:=TStringStream. Create (");
PostList:=TStringList. Create;
Try
IdHTTP1. Request. UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon) ';
PostList. Add (' id=admin);
PostList. Add (ps='1');
IdHTTP1. Post (' http://www.zhezhisd.cn/admin_in.asp ', postList, Response);
The finally
Memo1. Lines. Text:=Response. DataString;
The Response. Free;
PostList. Free;
end;

end;
I write so that it can be:
IdHTTP1. Post (' http://www.zhezhisd.cn/admin_in.asp/? id=admin& Ps=1 ', postList, Response);
And like the above submission is not successful, could you tell me why? The post of the second parameter is not used to submit some parameters?

CodePudding user response:

Behind the parameters of the string is id=admin & amp; ps=1, when you Add parameters this & amp; What is missing?

CodePudding user response:

To learn,...

CodePudding user response:

This depends on the server parsed,

CodePudding user response:

reference 1st floor omagic response:
behind the parameters of the string is id=admin& amp; Ps=1, when you Add parameters this & amp; amp; What is missing?


The original poster is used here TStringList. When the ADD will automatically ADD & amp; Symbols.
If is TStringStream ADD, you must ADD & amp;
You see the HTTP headers to see if there is a problem, also, your url nowhere, want to test all can't help you!
Look from the code, there is no problem.

CodePudding user response:

reference 4 floor lovemit response:
reference 1st floor omagic response:
Behind the parameters of the string is id=admin& amp; amp; Ps=1, when you Add parameters this & amp; amp; amp; What is missing?


The original poster is used here TStringList. When the ADD will automatically ADD & amp; amp; Symbols.
If is TStringStream ADD, you must ADD & amp; amp;
You see the HTTP headers to see if there is a problem, also, your url nowhere, don't want to test... .
IdHTTP1 Post (' http://www.qsyou.com/login.php? The username=1008 & amp; Password=123456 ', postList, Response);
Give it a try

CodePudding user response:

Consult! How to use IDhttp

CodePudding user response:

IdHTTP1. Post (url, postList);
This is ok
  • Related