Форум по Delphi программированию

Delphi Sources



Вернуться   Форум по Delphi программированию > Все о Delphi > Интернет и сети
Ник
Пароль
Регистрация <<         Правила форума         >> FAQ Пользователи Календарь Поиск Сообщения за сегодня Все разделы прочитаны

Ответ
 
Опции темы Поиск в этой теме Опции просмотра
  #1  
Старый 13.02.2013, 08:39
ProDaNTe ProDaNTe вне форума
Новичок
 
Регистрация: 25.12.2011
Сообщения: 75
Репутация: 10
По умолчанию Пост запрос не работает в Win8

Делаю прогу, по добавлению новостей на сайт, на XP,Win7 всё 32 бита - отправка запроса работает,в Win 8 (64) не отправляет!!!
Вот этот запрос???
Код:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
procedure TUploadImage.Execute;
var
host,site,header,stran,ht,attach,attach2,par1,par2,par3:String;
post:AnsiString;
stop:Boolean;
t:integer;
fpr:String;
stream:TFilestream;
tex,boun,boundary:AnsiString;
HEX_DIGITS,nor:String;
Numread:DWORD;
buf:array [0..1023] of byte;
bf:byte;
cli:integer;
buffile:byte;      
ms:TStringStream;
att:TStringStream;
 num:DWORD;
  I: Integer;
  ext,sil:String;
  bn: Integer;
  h: integer;
    hhRequest:HINTERNET;
begin
  inherited;
Randomize;       //62
cli:=0;
//ftgh
 
    boundary:='';
HEX_DIGITS:='0123456789AaBbCcDdEeFfGgHgIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz';
   sil:=Form4.sEdit2.Text;
fpr:=Copy(sil,LastDelimiter('/',sil)+1,Length(sil)-LastDelimiter('/',sil));
     ms:=TStringStream.Create;
      ext:=ExtractFileExt(sil);
       ms.LoadFromFile(extractfilepath(Application.ExeName)+'Page_Tor'+ext);
         host:=Form3.sEdit1.Text;
         site:=Form3.sEdit10.Text;
         stran:=Form3.sEdit38.Text;
      Header:='Referer: http://'+host+'/'+site+#13+
'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'  +#13+
'Accept-Language: ru,ru-RU;q=0.9,en;q=0.8 '+#13+
'Accept-Encoding:gzip, deflate  '+#13+
'Connection: Keep-Alive ';
  Form4.sListBox1.Items.Add('3');
      hhURL := InternetOpenUrl(hhInet,
    PChar('http://'+host+stran),
    pchar(Header),
    StrLen(pchar(Header)),
    0,                            // INTERNET_FLAG_EXISTING_CONNECT
    0);
    stop:=false;
 
    repeat
    nor:=HEX_DIGITS[Random(61)];
    if (nor<>'') and (Ord(nor)<>0) then begin
    for h := 1 to 61 do
   begin
   if nor=HEX_DIGITS[h] then begin
    boun:=boun+nor;
   end;
   end;
    end;
    nor:='';
   if length(boun)>=22 then stop:=true;
    until stop=true;
 
 
    boundary:='----------'+boun;
          Header:='Referer: http://'+host+stran+#13+
'Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1'  +#13+
'Accept-Language: ru,ru-RU;q=0.9,en;q=0.8 '+#13+
//'Accept-Encoding:gzip, deflate  '+#13+
'Connection: Keep-Alive '+#13+
'Content-Type: multipart/form-data; boundary='+ boundary;
      ht:='HTTP/1.1';
   post:='--'+boundary+#13+#10+'Content-Disposition: form-data; name="subaction"'+#13+#10+#13+#10+'upload'+#13+#10+
  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="area"'+#13+#10+#13+#10+'short_story'+#13+#10+
  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="action"'+#13+#10+#13+#10+'quick'+#13+#10+
  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="images_number"'+#13+#10+#13+#10+'1'+#13+#10+
  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="file_1"; filename="'+fpr+'"'+#13+#10+
  'Content-Type: image/jpeg'+#13+#10+#13+#10+  ms.DataString+#13+#10+        //Form4.memor.Text
 '--'+boundary+#13+#10+'Content-Disposition: form-data; name="imageurl"' +#13+#10+#13+#10+#13+#10;
 
    if Form5.sComboBox4.ItemIndex=0 then begin
      post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_size"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
    '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_seite"'+#13+#10+#13+#10+'0'+#13+#10;
    end;
        if Form5.sComboBox4.ItemIndex=1 then begin
      post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_size"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
    '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_seite"'+#13+#10+#13+#10+'1'+#13+#10;
    end;
        if Form5.sComboBox4.ItemIndex=2 then begin
      post:=post+  '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_size"'+#13+#10+#13+#10+Form5.sedit1.text+#13+#10+
    '--'+boundary+#13+#10+'Content-Disposition: form-data; name="t_seite"'+#13+#10+#13+#10+'2'+#13+#10;
 
    end;
 
    if Form5.sCheckBox5.Checked=true then begin
     post:=post+'--'+boundary+#13+#10+'Content-Disposition: form-data; name="make_thumb"'+#13+#10+#13+#10+'make_thumb'+#13+#10 ;
    end;
 
 
 
 
 
  post:=post+'--'+boundary+'--'+#13+#10;
       t:= Length(post);
        // Form4.sMemo3.Text:=Header;
 
     Form4.sListBox1.Items.Add(post);
 
  hhUrl:=InternetConnect(hhInet,PChar(host),INTERNET_DEFAULT_HTTP_PORT,nil,nil,INTERNET_SERVICE_HTTP,0,0);
 
  hhRequest:=HttpOpenRequest(hhURL,'POST',pchar(stran),pchar(ht),nil,nil,0,0);
 
  HttpSendRequest(hhRequest,PChar(Header),Length(Header),PChar(post),t);
 
 
cli:=0;
stop:=false;
stream:=TFileStream.Create(extractfilepath(Application.ExeName)+'OtvetZagrImage.html',fmCreate);
while stop=false do
begin
InternetReadFile(hhRequest,@Buf,sizeof(Buf),NumRead);
Stream.Write(Buf,Numread);
 if Numread=0 then cli:=cli+1;
 if cli>=3 then  stop:=true;
end;
stream.Free;
       tex:='';
      att:=TStringStream.Create;
       att.LoadFromFile(extractfilepath(Application.ExeName)+'OtvetZagrImage.html');
 tex:=LowerCase(att.DataString);
 
  if pos('400 bad reques',LowerCase(tex))<>0 then begin
   Form4.Timer3.Enabled:=true;
  end else begin
 fpr:=AnsiReplaceStr(fpr,'[','');
 fpr:=AnsiReplaceStr(fpr,']','');
   fpr:=AnsiReplaceStr(fpr,'(','');
 fpr:=AnsiReplaceStr(fpr,')','');
par1:=Copy(tex,pos(LowerCase(fpr)+'<',tex)-150,150);
par2:=Copy(par1,pos('http',par1),150);
par3:=Copy(par2,0,pos(fpr,par2)-1+length(fpr));
if Form5.sComboBox5.ItemIndex=0 then attach:='[thumb]'+par3+'[/thumb]';
if Form5.sComboBox5.ItemIndex=1 then attach:='[thumb=left]'+par3+'[/thumb]';
if Form5.sComboBox5.ItemIndex=2 then attach:='[thumb=right]'+par3+'[/thumb]';
if Form5.sComboBox5.ItemIndex=3 then attach:='<div align="center">[thumb]'+par3+'[/thumb]</div>';
if Form5.sComboBox7.ItemIndex=0 then attach2:='[thumb]'+par3+'[/thumb]';
if Form5.sComboBox7.ItemIndex=1 then attach2:='[thumb=left]'+par3+'[/thumb]';
if Form5.sComboBox7.ItemIndex=2 then attach2:='[thumb=right]'+par3+'[/thumb]';
if Form5.sComboBox7.ItemIndex=3 then attach2:='<div align="center">[thumb]'+par3+'[/thumb]</div>';
if par3<>'' then begin
 Form4.sGauge4.Progress:=1;
 Form4.sEdit7.Text:=par3;
if Form5.sCheckBox7.Checked=true then begin
Form4.sMemo1.Text:=attach+Form4.sMemo1.Text;
//
end;
if Form5.sCheckBox8.Checked=true then begin
Form4.sMemo2.Text:=attach2+Form4.sMemo2.Text;
//Form4.sGauge2.Progress:=1;
end;
end;
 
 Form4.sButton8.Enabled:=true;
  end;
 
 att.Free;
 ms.Free;
 
end;
Ответить с цитированием
  #2  
Старый 15.02.2013, 10:40
ProDaNTe ProDaNTe вне форума
Новичок
 
Регистрация: 25.12.2011
Сообщения: 75
Репутация: 10
По умолчанию

Ну помогите пожалуйста, если в дебуге запускать то выдаёт EOSError неверный дискриптор окна!!!
Причем ошибка идёт при выполнении
Код:
1
HttpSendRequest(hhRequest,PChar(Header),Length(Header),PChar(post),t);
Ответить с цитированием
Ответ


Delphi Sources

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы не можете редактировать сообщения

BB-коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход


Часовой пояс GMT +3, время: 04:59.


 

Сайт

Форум

FAQ

Соглашения

Прочее

 

Copyright © Форум "Delphi Sources" by BrokenByte Software, 2004-2025