
bueno solo he usado una linea de codigo y colocado en un boton para que e visualize en un webBrowser en delphi
WebBrowser1.Navigate('[url]http://www.infogob.com.pe/erm_2010/ficha.aspx?IdDni='+Edit1.TEXT+'&IdTab=0'[/url])
Escrito 02 enero 2011 - 08:48
WebBrowser1.Navigate('[url]http://www.infogob.com.pe/erm_2010/ficha.aspx?IdDni='+Edit1.TEXT+'&IdTab=0'[/url])
Escrito 02 enero 2011 - 09:03
Escrito 02 enero 2011 - 09:11
Hola Todos tengo una web en donde colocando mi numero de identificacion "DNI" me arroja la web con mi foto lo que deseo es guardar la foto de esta web en una carpeta "X" con el mismo Numero de DNI
bueno solo he usado una linea de codigo y colocado en un boton para que e visualize en un webBrowser en delphi
delphi
WebBrowser1.Navigate('[url]http://www.infogob.com.pe/erm_2010/ficha.aspx?IdDni='+Edit1.TEXT+'&IdTab=0'[/url])
Escrito 03 enero 2011 - 04:04
uses Wininet; const Etiqueta = '<img id="ctl00_ContentPlaceHolder1_imgPolitico" src="'; procedure SendRequest(Stream: TStream; Url: String); var hNet: HINTERNET; hCon: HINTERNET; hReq: HINTERNET; Context: DWORD; BytesRead: DWORD; Success: Boolean; Buffer: PChar; begin Context:= 0; hNet := InternetOpen('Agente86', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if (hNet <> nil) then begin hCon:= InternetConnect(hNet,'[url=http://www.infogob.com.pe]www.infogob.com.pe[/url]',80,nil,nil, INTERNET_SERVICE_HTTP,0,Context); if (hCon <> nil) then begin hReq:= HttpOpenRequest(hCon,'GET',PChar(Url),nil,nil,nil, INTERNET_FLAG_RELOAD,Context); if (hReq <> nil) then begin Success:= HttpSendRequest(hReq, nil,Cardinal(-1),nil,0); if Success then begin GetMem(Buffer,32*1024); try while (InternetReadFile(hReq,Buffer,32*1024,BytesRead)) do begin if (BytesRead = 0) then break; Stream.Write(Buffer^,BytesRead) end; finally FreeMem(Buffer); end; end; InternetCloseHandle(hReq); end; InternetCloseHandle(hCon); end; InternetCloseHandle(hNet); end; end; procedure GuardarImagen(Dni, Path: String); var i: integer; Str, Url: String; Stream: TMemoryStream; begin Stream:= TMemoryStream.Create; try SendRequest(Stream,'/erm_2010/ficha.aspx?IdDni='+Dni+'&IdTab=0'); Str:= Utf8Decode(PChar(Stream.Memory)); i:= Pos(Etiqueta,Str); if i = 0 then Exit; inc(i,Length(Etiqueta)); Url:= EmptyStr; while (i < Length(Str)) do begin if Str[i] = '"' then break; Url:= Url + Str[i]; inc(i); end; if Url = EmptyStr then Exit; Stream.Clear; SendRequest(Stream,'/erm_2010/'+StringReplace(Url,'&','&',[rfReplaceAll,rfIgnoreCase])); Stream.SaveToFile(Path); finally Stream.Free; end; end;
GuardarImagen('43673372','E:\fotos\43673372.jpg');
var i: Cardinal; begin for i:= 43673372 to 43673472 do // El rango que queramos GuardarImagen(IntToStr(i),'E:\fotos\' + IntToStr(i) + '.jpg'); end;
Escrito 03 enero 2011 - 07:06
Escrito 03 enero 2011 - 07:36
Escrito 03 enero 2011 - 03:31
Escrito 03 enero 2011 - 03:44
podrías adjuntar el archivo creado seoane para poder ver si esta guardando la foto con las dimensiones que según creo que son
uses Wininet, StrUtils; const Etiqueta = '<img id="ctl00_ContentPlaceHolder1_imgPolitico" src="'; procedure SendRequest(Stream: TStream; Url: AnsiString); var hNet: HINTERNET; hCon: HINTERNET; hReq: HINTERNET; Context: DWORD; BytesRead: DWORD; Success: Boolean; Buffer: PChar; begin Context:= 0; hNet := InternetOpenA('Agente86', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if (hNet <> nil) then begin hCon:= InternetConnectA(hNet,'[url=http://www.infogob.com.pe]www.infogob.com.pe[/url]',80,nil,nil, INTERNET_SERVICE_HTTP,0,Context); if (hCon <> nil) then begin hReq:= HttpOpenRequestA(hCon,'GET',PAnsiChar(Url),nil,nil,nil, INTERNET_FLAG_RELOAD,Context); if (hReq <> nil) then begin Success:= HttpSendRequestA(hReq, nil,Cardinal(-1),nil,0); if Success then begin GetMem(Buffer,32*1024); try while (InternetReadFile(hReq,Buffer,32*1024,BytesRead)) do begin if (BytesRead = 0) then break; Stream.Write(Buffer^,BytesRead) end; finally FreeMem(Buffer); end; end; InternetCloseHandle(hReq); end; InternetCloseHandle(hCon); end; InternetCloseHandle(hNet); end; end; procedure GuardarImagen(Dni: AnsiString; Path: String); var i: integer; Str, Url: AnsiString; Stream: TMemoryStream; a:widestring; begin Stream:= TMemoryStream.Create; try SendRequest(Stream,'/erm_2010/ficha.aspx?IdDni='+Dni+'&IdTab=0'); Str:= AnsiString(PAnsiChar(Stream.Memory)); i:= AnsiPos(String(Etiqueta),String(Str)); if i = 0 then Exit; inc(i,Length(Etiqueta)); Url:= ''; while (i < Length(Str)) do begin if Str[i] = '"' then break; Url:= Url + Str[i]; inc(i); end; if Url = '' then Exit; Stream.Clear; SendRequest(Stream,AnsiString('/erm_2010/') + AnsiString(AnsiReplaceText(String(Url),AnsiString('&'),AnsiString('&')))); Stream.SaveToFile(Path); finally Stream.Free; end; end;
Escrito 03 enero 2011 - 03:48
Escrito 10 enero 2011 - 01:47
Hola Todos tengo una web en donde colocando mi numero de identificacion "DNI" me arroja la web con mi foto lo que deseo es guardar la foto de esta web en una carpeta "X" con el mismo Numero de DNI
bueno solo he usado una linea de codigo y colocado en un boton para que e visualize en un webBrowser en delphi
delphi
WebBrowser1.Navigate('[url]http://www.infogob.com.pe/erm_2010/ficha.aspx?IdDni='+Edit1.TEXT+'&IdTab=0'[/url])
Escrito 10 enero 2011 - 03:27
les informo que al escribir:
http://www.infogob.c...7768359&IdTab=0
me redirige a:
http://www.infogob.c...2010/ficha.aspx
alguna ayudita para guardar las fotos
Escrito 10 enero 2011 - 04:25
les informo que al escribir:
http://www.infogob.c...7768359&IdTab=0
me redirige a:
http://www.infogob.c...2010/ficha.aspx
alguna ayudita para guardar las fotos
Se deben de haber enfadado por lo del otro día porque la url dejo de funcionar, o a lo mejor se dieron cuenta del terrible fallo de seguridad que tenían y por fin decidieron taparlo, en cualquier caso los datos de los confiados ciudadanos ya están mas seguros