{"id":271,"date":"2008-05-10T10:12:09","date_gmt":"2008-05-10T10:12:09","guid":{"rendered":"http:\/\/6teen.ru\/?p=91"},"modified":"2008-05-10T10:12:09","modified_gmt":"2008-05-10T10:12:09","slug":"4711","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=271","title":{"rendered":"\u0414\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b"},"content":{"rendered":"<p>\u0414\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u0414\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\/\/\n\/\/  \u0414\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b\n\/\/  \u0410\u0432\u0442\u043e\u0440: \u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 (Rouse_) \u0411\u0430\u0433\u0435\u043b\u044c\n\/\/  c Fangorn Wizards Lab 1998 - 2003\n\/\/  19 \u044f\u043d\u0432\u0430\u0440\u044f 2003\n\nunit Unit1;\n\ninterface\n\nuses\nWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms,\nDialogs, ComCtrls, Wininet, StdCtrls;\n\nconst\nHTTP_PORT = 80;\nCRLF = #13#10;\nHeader = 'Content-Type: application\/x-www-form-urlencoded' + CRLF;\n\ntype\nTForm1 = class(TForm)\nButton1: TButton;\nMemo1: TMemo;\nButton2: TButton;\nMemo2: TMemo;\nprocedure Button1Click(Sender: TObject);\nprocedure Button2Click(Sender: TObject);\nend;\n\nvar\nForm1: TForm1;\n\nimplementation\n\n{$R *.dfm}\n\nfunction DelHttp(URL: String): String;\nbegin\nif Pos('http:\/\/', URL) > 0 then Delete(Url, 1, 7);\nResult := Copy(Url, 1, Pos('\/', Url) - 1);\nif Result = '' then Result := URL + #0;\nend;\n\nfunction GetUrl(const URL: String): String;\nvar\nFSession, FConnect, FRequest: HINTERNET;\nFHost, FScript, SRequest: String;\nAnsi: PAnsiChar;\nBuff: array [0..1023] of Char;\nBytesRead: Cardinal;\nRes, Len: DWORD;\nbegin\nResult := '';\n\/\/ \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\n\/\/ \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443\nFHost := DelHttp(Url);\nFScript := Url;\nDelete(FScript, 1, Pos(FHost, FScript) + Length(FHost));\n\/\/FScript := FHost + '\/' +FScript;\n\n\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c WinInet\nFSession := InternetOpen('DMFR', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);\nif not Assigned(FSession) then Exit;\ntry\n\/\/ \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c\nFConnect := InternetConnect(FSession, PChar(FHost), HTTP_PORT, nil,\n'HTTP\/1.0', INTERNET_SERVICE_HTTP, 0, 0);\nif not Assigned(FConnect) then Exit;\ntry\n\/\/ \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b\nAnsi := 'text\/*';\nFRequest := HttpOpenRequest(FConnect, 'GET', PChar(FScript), 'HTTP\/1.1',\nnil, @Ansi, INTERNET_FLAG_RELOAD, 0);\nif not Assigned(FConnect) then Exit;\ntry\n\/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438\nif not (HttpAddRequestHeaders(FRequest, Header, Length(Header),\nHTTP_ADDREQ_FLAG_REPLACE or\nHTTP_ADDREQ_FLAG_ADD or\nHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA)) then Exit;\n\n\/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441:\nLen := 0;\nRes := 0;\nSRequest := ' ';\nHttpQueryInfo(FRequest, HTTP_QUERY_RAW_HEADERS_CRLF or\nHTTP_QUERY_FLAG_REQUEST_HEADERS, @SRequest[1], Len, Res);\nif Len > 0 then\nbegin\nSetLength(SRequest, Len);\nHttpQueryInfo(FRequest, HTTP_QUERY_RAW_HEADERS_CRLF or\nHTTP_QUERY_FLAG_REQUEST_HEADERS, @SRequest[1], Len, Res);\nend;\nForm1.Memo2.Lines.Text := SRequest;\n\/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\nif not (HttpSendRequest(FRequest, nil, 0, nil, 0)) then Exit;\n\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\nFillChar(Buff, SizeOf(Buff), 0);\nrepeat\nResult := Result + Buff;\nFillChar(Buff, SizeOf(Buff), 0);\nInternetReadFile(FRequest, @Buff, SizeOf(Buff), BytesRead);\nuntil BytesRead = 0;\nfinally\nInternetCloseHandle(FRequest);\nend;\nfinally\nInternetCloseHandle(FConnect);\nend;\nfinally\nInternetCloseHandle(FSession);\nend;\nend;\n\nprocedure TForm1.Button1Click(Sender: TObject);\nbegin\nMemo1.Text := GetUrl('http:\/\/forum.sources.ru\/index.php?showforum=14');\nend;\n\nprocedure TForm1.Button2Click(Sender: TObject);\nbegin\nMemo1.Text := GetUrl('http:\/\/forum.sources.ru\/');\nend;\n\nend.\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0435\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f HTML \u043a\u043e\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[448,457],"tags":[533,690,799,288,1005],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/271"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=271"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/271\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=271"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}