Ver Mensaje Individual
  #1  
Antiguo 27-05-2013
darkamerico darkamerico is offline
Miembro
 
Registrado: dic 2010
Posts: 273
Reputación: 16
darkamerico Va por buen camino
Smile Como puedo leer una pagina web y almacenarla en una variable

Dentro de mi aplicacion, necesito consultar la pagina: http://www.sbs.gob.pe/0/modulos/jer/...&pfl=0&jer=147

Ya que dentro de ella hay dos elementos llamados:

<p class="WEB_compra">
Compra
<span>2.673</span>
</p>

<p class="WEB_venta">
Venta
<span>2.676</span>
</p>

Que son los Tipos de Cambio de la Superintendencia de Banca y Seguros, pero no deseo utilizar un TWebBrowser, simplemente leer el archivo, luego extraer esos dos elementos y colocarlos en sus respectivos TLabel en la aplicacion.

Estuve investigando y encontre algo como esto:

Código Delphi [-]
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
var
  Document: IHTMLDocument3;
  Collection: IHTMLElementCollection;
  Element: IHTMLElement;
  InputElement: IHTMLInputElement;
begin
  Document := (WebBrowser1.Document as IHTMLDocument3);
  Collection := Document.getElementsByName('WEB_compra');

  if (Collection.length >= 0) then
  begin
    Element := Collection.item(0, 0) as IHTMLElement;
    Element.QueryInterface(IHTMLInputElement, InputElement);

    if Assigned(InputElement) and (InputElement.type_ = 'text') then
      ShowMessage(InputElement.value);
  end;
end;

Sin embargo utilizan un TWebBrowser.

Si alguien me puede dar un alcance, lo agradecería mucho.

Atte.

Americo
Responder Con Cita