Thread View: borland.public.cppbuilder.internet.web
12 messages
12 total messages
Started by Eduardo Jauch
Fri, 02 Feb 2007 21:50
How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Fri, 02 Feb 2007 21:50
Date: Fri, 02 Feb 2007 21:50
13 lines
1256 bytes
1256 bytes
Hi, I'm doing what I think is a "webrobot" I load a page and then navigate it by program. It's all working, but how can I avoid the component to load the images? I make a search in google newsgroups with cppwebbrowser, image and picture, but only find a Delphi code to modify the windows registry... There's other way? Thanks :)
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Fri, 02 Feb 2007 23:12
Date: Fri, 02 Feb 2007 23:12
6 lines
1165 bytes
1165 bytes
Searching more, I found a post where Remy told that will be necessary write a IOleClientSite derived class... Someone can show an example of that? Thanks! :)
Re: How to NOT download Images when using TCppWebBrowser?
Author: Tom
Date: Fri, 02 Feb 2007 23:54
Date: Fri, 02 Feb 2007 23:54
7 lines
1082 bytes
1082 bytes
If you're simply gathering text, why use a browser at all? Using a component like Indy to get the source code and parse out what you want. Regards, Tom
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 00:54
Date: Sat, 03 Feb 2007 00:54
24 lines
1593 bytes
1593 bytes
Tom escreveu: > If you're simply gathering text, why use a browser at all? Using a component > like Indy > to get the source code and parse out what you want. > > Regards, > > Tom > > I'd like this solution... But I only learn to use TCppWebBrowser now... Don't Know How to use Indy... Besides, the Http component of Indy can execute the Java code that are in the page I load? Can you put some code (or show me where to find)? Like load an HTML page that contain an text input and a link and the code change the text input and execute the link? Thanks :)
Re: How to NOT download Images when using TCppWebBrowser?
Author: Tom
Date: Sat, 03 Feb 2007 01:45
Date: Sat, 03 Feb 2007 01:45
16 lines
1649 bytes
1649 bytes
> Besides, the Http component of Indy can execute the Java code that are in > the page I load? No Indy cannot execute Java or Javascript, however it depends upon what you're really trying to accomplish. > Can you put some code (or show me where to find)? > Like load an HTML page that contain an text input and a link and the code > change the text input and execute the link? Do you have an example of exactly what you're trying to automate? I think you're wanting to submit a form, but without seeing the code for that form, I can't really give you an exact answer. -Tom
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 02:05
Date: Sat, 03 Feb 2007 02:05
30 lines
1761 bytes
1761 bytes
Ok. :)
I have a page with a Frame.
In this Frame, I have this (sample):
<script>
function enviar()
{
var frm = document.forms[0];
frm.action = "/agendamento-web/login";
frm.task.value = 'login';
frm.method = "POST";
frm.submit();
}
</script>
<input name="login" type="text" class="box_tabela" size="30">
<input name="senha" type="password" class="box_tabela" size="30">
<a href="javascript: enviar();"><img
src="/agendamento-web/images/pt_BR/bt_submeter.gif" border="0"></a>
Using Indy, how to set the input values and is possible to use the java
script to submit the values?
:)
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 02:13
Date: Sat, 03 Feb 2007 02:13
45 lines
1888 bytes
1888 bytes
Another question...
What is "parser"?
Is something like find the information in the HTML?
When I use TCppWebBrowser, I use Something like this:
IHTMLDocument2 *FrameDoc;
IHTMLElementCollection *All;
IDispatch *Disp;
IHTMLInputElement *pInput;
FrameDoc = EncontrarFrame(WideString("iContent"));
if( FrameDoc )
{
FrameDoc->get_all(&All);
if( All )
{
All->item(TVariant(WideString("login")), TVariant(0), &Disp);
if( Disp )
{
Disp->QueryInterface(IID_IHTMLInputElement, (LPVOID*)&pInput);
Disp->Release();
if( pInput )
{
WideString wsValue("JULIA");
pInput->put_value(wsValue);
pInput->Release();
}
}
}
}
How to do this using Indy?
Re: How to NOT download Images when using TCppWebBrowser?
Author: Tom
Date: Sat, 03 Feb 2007 02:21
Date: Sat, 03 Feb 2007 02:21
17 lines
1650 bytes
1650 bytes
Alright here's an example that will accomplish what you want. I've purposely
left out error checking to keep it
fairly simple.
TIdMultiPartFormDataStream *PostData = new TIdMultiPartFormDataStream;
PostData->AddFormField("login", fldUsername->Text); // fldUsername is just
a text edit for the user to enter it in
PostData->AddFormField("senha", fldPassword->Text); // same as above for
fldPassword
AnsiString LoginResult =
Http->Post(http://www.url.com/agendamento-web/login, PostData);
delete PostData;
Also, what all needs to be accomplished after login?
-Tom
Re: How to NOT download Images when using TCppWebBrowser?
Author: Tom
Date: Sat, 03 Feb 2007 02:24
Date: Sat, 03 Feb 2007 02:24
17 lines
1539 bytes
1539 bytes
> What is "parser"? A parser is simply an algorithm for processing the source code from the website. TCPPWebBrowser has a built in parser, which the source code you posted accesses. However, when using Indy, if you're wanting to extract links or text from the source you need to code that yourself. I really need to know what all you're trying to do after logging in, etc. There's ways of using TCppWebBrowser to fill in the form without javascript, etc. -Tom
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 02:39
Date: Sat, 03 Feb 2007 02:39
28 lines
2197 bytes
2197 bytes
Tom escreveu: > However, when using Indy, if you're wanting to extract links or text from > the source > you need to code that yourself. You know of someone that have code for this? Or a component? > I really need to know what all you're trying to do after logging in, etc. I'm trying to make a "webrobot"??? I send the login information, and Another page is loaded in the frame. When this another page is loaded, I simple Load by myself another page, I know the link (is soething like "javascript: agendamentos()" , so, I don't need to "find" nothing in this page. I do this type of things until load a page that i need to fill a form... Sometimes the values are in input text, other in input select (combo box). The final page has a check box. I mark and go to the next page (always with a javascript). On The next page I need to read the values that are in some input select (combo box). If I don't find what I need, I go back and begins all again (from the final page), until I find the values I need... :)
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 03:03
Date: Sat, 03 Feb 2007 03:03
5 lines
1313 bytes
1313 bytes
Tom escreveu: > TIdMultiPartFormDataStream *PostData = new TIdMultiPartFormDataStream; In what header is the definition for this?
Re: How to NOT download Images when using TCppWebBrowser?
Author: Eduardo Jauch
Date: Sat, 03 Feb 2007 03:36
Date: Sat, 03 Feb 2007 03:36
74 lines
3111 bytes
3111 bytes
Eduardo Jauch escreveu:
> Tom escreveu:
>
>> TIdMultiPartFormDataStream *PostData = new TIdMultiPartFormDataStream;
>
> In what header is the definition for this?
>
I think that there's no component like this at the Indy that I have (I
don't know the version, but comes with the BCB 2006).
I try this instead:
TMemoryStream *strm = new TMemoryStream;
TStringList *values = new TStringList;
AnsiString value;
value = "MYLOGIN";
values->Add("login=" + value);
value = "MYPASSWORD";
values->Add("senha=" + value);
IdHTTP1->Post("http://www.visto-eua.com.br/agendamento-web/login",
values, strm);
strm->Position = 0;
Memo1->Lines->Clear();
Memo1->Lines->LoadFromStream(strm);
delete values;
delete strm;
But I get an error 500 internal server error
I put the LOGIN and 123456 between \' and \", because I think that the
server is refusing the values I give. (login and password)
The password is encrypted no?
What am I doing wrong?
HTML (more complete):
This is the HTML in the FRAME
<script>
function enviar()
{
var frm = document.forms[0];
frm.action = "/agendamento-web/login";
frm.task.value = 'login';
frm.method = "POST";
frm.submit();
}
</script>
<form name="loginForm" method="get" action="/agendamento-web/login">
<input type="hidden" name="task" value="">
<input type="hidden" name="item" value="">
<input type="hidden" name="tipo" value="AGENCIA DE VIAGEM">
<input type="hidden" name="redirect" value="/agenciadores.do">
<input name="login" type="text" class="box_tabela" size="30">
<input name="senha" type="password" class="box_tabela" size="30">
<a href="javascript: enviar();"><img
src="/agendamento-web/images/pt_BR/bt_submeter.gif" border="0"></a>
</form>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads