Use the TIDHTTP control to page access

xiaoxiao2021-03-06  40

Seabird

Use the TIDHTTP control to page access

Procedure MSG (Var theuser: tusefo);

VAR

URL: String;

Tempstr: widestring;

RESPONSE: TSTRINGSTREAM;

Request: TStrings; // Used to store information on the page, transfer with the request, will be automatically encapsulated in Form

SQLID, CODE, STATUS: STRING

Temp: integer;

MYSTRINGLIST: TSTRINGLIST;

Begin

IDHTTP_MAIN is a TIDHTTP control

Response: = TStringStream.create ('');

Request: = TSTRINGLIST.CREATE;

Try

URL: = 'http://coderclub/sms/hz/xx.asp';

Request.Append ('seqid =' theuser.seqid);

Request.append ('Mobile =' theuser.mob);

Request.append ('spcode =' theuser.spc);

Request.Append ('msg =' theuser.msg);

Service1.idhttp_main.request.contentType: = 'Application / X-www-form-urlencoded';

Service1.idhttp_main.post (URL, Request, Response);

//Response.DataString stores the HTML code that returns to the page, this example is obtained in the way

Tempstr: = LowerCase (response.dataString);

Tempstr: = Leftstr (Tempstr, POS ('', TEMPSTR) 16);

Temp: = POS ('', tempstr);

SQLID: = Midstr (Tempstr, POS ('', tempstr) 7, POS ('', tempstr) -Temp-7);

IF not isnumber (sqlid) THEN

Begin

MyStringList: = TSTRINGLIST.CREATE;

IF FileExists (ExtractFilePath (paramstr (0)) 'Err.txt') THEN

MyStringList.LoadFromFile (ExtractFilePath) 'Err.txt';

MyStringList.Add ('(' DateTimetostr (now) ') SEQID (' SQLID ') unknown');

MYSTRINGLIST.SAVETOFILE (ExtractFilePath) 'Err.txt';

MyStringList.Free;

end

Else

Begin

Code: = Midstr (Tempstr, POS ('', tempstr) 6, POS ('', tempstr) -pos ('', tempstr) -6); if not isnumber Code) THEN

Begin

MyStringList: = TSTRINGLIST.CREATE;

IF FileExists (ExtractFilePath (paramstr (0)) 'Err.txt') THEN

MyStringList.LoadFromFile (ExtractFilePath) 'Err.txt';

MyStringList.Add (DateTimetostr (now) '[SQLID:' SQLID '] Errors Unknown');

MYSTRINGLIST.SAVETOFILE (ExtractFilePath) 'Err.txt';

MyStringList.Free;

Code: = '1';

STATUS: = '(error code unknown)';

END;

Status: = Status Midstr (Tempstr, POS ('', tempstr) 8, POS ('', tempstr) -pos ('', tempstr) -8);

With service1.adoquery_temp do

Begin

CONNECTION: = conn_client;

CLOSE;

SQL.CLEAR;

Sql.add ('update' gameinfo.deliver_table_log 'set code =' code ', status =' '' status '' 'where seqid =' theuser.seqid);

EXECSQL;

END;

END;

Finally

Request.free;

Response.Free;

END;

END;

----------------------------------------- Why is it like? One sand gull in the world.

转载请注明原文地址:https://www.9cbs.com/read-74895.html

New Post(0)