 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 3:50 am Post subject: How to NOT download Images when using TCppWebBrowser? |
|
|
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  |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 5:12 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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!  |
|
| Back to top |
|
 |
Tom Guest
|
Posted: Sat Feb 03, 2007 5:54 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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 |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 6:54 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
Tom escreveu:
| Quote: | 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  |
|
| Back to top |
|
 |
Tom Guest
|
Posted: Sat Feb 03, 2007 7:45 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
| Quote: | 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.
| Quote: | 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 |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 8:05 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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?
:) |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 8:13 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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? |
|
| Back to top |
|
 |
Tom Guest
|
Posted: Sat Feb 03, 2007 8:21 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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 |
|
| Back to top |
|
 |
Tom Guest
|
Posted: Sat Feb 03, 2007 8:24 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
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 |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 8:39 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
Tom escreveu:
| Quote: | 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?
| Quote: | 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...
:) |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 9:03 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
Tom escreveu:
| Quote: | TIdMultiPartFormDataStream *PostData = new TIdMultiPartFormDataStream;
|
In what header is the definition for this? |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 9:10 am Post subject: Re: How to NOT download Images when using TCppWebBrowser? |
|
|
Eduardo Jauch escreveu:
| Quote: | 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> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|