BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can i do?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker
View previous topic :: View next topic  
Author Message
Ricardo Carmo
Guest





PostPosted: Fri Aug 06, 2004 6:06 pm    Post subject: How can i do? Reply with quote



Hi all.

The scene:
There is a web page on internet with some fields to get data (a form) from
the user,
and a button "submit" to process the data and return a html page. Itīs a PHP
web service.

The problem:
I want "bypass" the form and the button submit, to send data directly to web
service
and get the result (the html page) to show it in a IE instance (or a
TWebBrowser, maybe).

Is it possible to do this using Delphi?
how can i do?

Thanks.
Ricardo Carmo.


Back to top
Dmeister
Guest





PostPosted: Fri Aug 06, 2004 7:49 pm    Post subject: Re: How can i do? Reply with quote



Yes. Take a look at the Indy http component.

"Ricardo Carmo" <rsc.maceio (AT) bol (DOT) com.br> wrote

Quote:
Hi all.

The scene:
There is a web page on internet with some fields to get data (a form) from
the user,
and a button "submit" to process the data and return a html page. Itīs a
PHP
web service.

The problem:
I want "bypass" the form and the button submit, to send data directly to
web
service
and get the result (the html page) to show it in a IE instance (or a
TWebBrowser, maybe).

Is it possible to do this using Delphi?
how can i do?

Thanks.
Ricardo Carmo.





Back to top
Ricardo Carmo
Guest





PostPosted: Fri Aug 06, 2004 8:07 pm    Post subject: Re: How can i do? Reply with quote



Hi.
I've already used TidHTTP (see the code below),
but i want to know if exists any solution more efficient, or appropriated.

(sorry for my english)
TIA
Ricardo Carmo


procedure TFMain.ShowWEBPageClick(Sender: TObject);
var cVar1: string;
Response: TStringStream;
T: TStrings;
HTTP: TIdHTTP;
begin
cVar1:='ABC';
HTTP:=TIdHTTP.Create(FMain);
Screen.Cursor:=crHourGlass;
Response := TStringStream.Create('');
HTTP.Request.Referer :='http://www.myurl.com/index.php';
HTTP.Request.ContentType :='application/x-www-form-urlencoded';
HTTP.Request.Accept :='*/*';
HTTP.Request.UserAgent :='Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.0; .NET CLR 1.1.4322)';
HTTP.Request.Connection :='Keep-Alive';
HTTP.Request.AcceptLanguage:='pt-br';
HTTP.Request.ContentLength :=9;
HTTP.Host :='http://www.myurl.com';

T:=TStringList.Create;
T.Add('MyVar='+cVar1);
try
HTTP.Post('http://www.myurl.com/SomeService.php', T, Response);

T.Text:=Response.DataString;

T.SaveToFile('MyPage.htm');
ShellExecute(0,'open',PChar('MyPage.htm'),'','',SW_SHOWNORMAL);

Screen.Cursor := crDefault;
except
on E: Exception do begin
Screen.Cursor := crDefault;
MessageDlg('Error:'+#13+E.Message,mtInformation,[mbOk],0);
end;
end;
T.Free;
Response.Free;
HTTP.Free;
{$ENDIF}
end;

"Dmeister" <daoud (AT) malikyar (DOT) com> escreveu na mensagem
news:4113e0c0$1 (AT) newsgroups (DOT) borland.com...
Quote:
Yes. Take a look at the Indy http component.

"Ricardo Carmo" <rsc.maceio (AT) bol (DOT) com.br> wrote in message
news:4113c896 (AT) newsgroups (DOT) borland.com...
Hi all.

The scene:
There is a web page on internet with some fields to get data (a form)
from
the user,
and a button "submit" to process the data and return a html page. Itīs a
PHP
web service.

The problem:
I want "bypass" the form and the button submit, to send data directly to
web
service
and get the result (the html page) to show it in a IE instance (or a
TWebBrowser, maybe).

Is it possible to do this using Delphi?
how can i do?

Thanks.
Ricardo Carmo.







Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.