Solved

Posting to an URL

Posted on 2000-05-02
13
244 Views
Last Modified: 2010-04-04
I want to open mi Internet Explorer from a delphi application to a url that needs passing of some parameters.  The problem is that the page accepts the parameters if they a sent from a html form using post method.

Does anyone know how to do it?
0
Comment
Question by:clopez
  • 6
  • 3
  • 3
  • +1
13 Comments
 
LVL 2

Expert Comment

by:craig_capel
ID: 2769638
edit1.text:='www.experts-exchange.com';
shellExecute(handle,'open',pchar(edit1.text),'','',0);

to send out an url.....


ShellExecute(Application.Handle,PChar('open'),PChar('mailto:name@usa.net'),PChar(''),nil,SW_NORMAL);

This opens the default mail browser and gets the email ready

hope that helps...


Craig C.
0
 
LVL 17

Expert Comment

by:geobul
ID: 2769737
Hi,
Does your URL contain script?
Do you know the names of these parameters (as they are in the previous html form)?

Regards, Geo
0
 

Author Comment

by:clopez
ID: 2769903
To craiq capel, your answer doen't send parametes using post method.  I justs opens the explorer
0
 

Author Comment

by:clopez
ID: 2769933
Geobul,

I think that that URL may have an script, but it must be in the server side.  In the resulting page there is no code.

The previous form looks like this:

<form method="POST" action="myacct.asp" name="login_form">
<input type="hidden" name="loc" value="">
ID: <input type="text" name="id" size="6" maxlength="6"><br>
Password: <input type="password" name="password" size="12" maxlength="12">
<input type="image" src="images/login.gif" border="0" value="submit" WIDTH="69" HEIGHT="43" id="image1" name="image1">
</form>

Also it may be important to say that is a secure page.
0
 
LVL 2

Expert Comment

by:Serega
ID: 2772987
I think using parameters in the url would be acceptable. For example:
edit1.text:='www.experts-exchange.com?password=password&text=sometext';
and open a browser with that url.
0
 

Author Comment

by:clopez
ID: 2773236
Sorry Serega, that doesn't work
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Accepted Solution

by:
Serega earned 200 total points
ID: 2773413
In that case I think you should to use WebBrowser control. It has a lot of methods and it is possible to do your task with it.
0
 

Author Comment

by:clopez
ID: 2774178
Any idea on how to do it?
0
 
LVL 2

Expert Comment

by:Serega
ID: 2776421
I don't know exactly how to do it. Try to search at EE for a word: WebBrowser.
Or see at http://www.euromind.com/iedelphi/getting_started.htm
0
 
LVL 17

Expert Comment

by:geobul
ID: 2777411
Hi,
Sorry for the late reply.
Now to the question:
1.Create a file 'c:\temp\start.html' on the local disk.
2.Write the following in the file:
---Cut---
<HTML>
<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--
function geo()
{
  login_form.OKBtn.click();
}
//-->
</SCRIPT>

</HEAD>
<BODY onLoad="geo()">

<form method="POST" action="myacct.asp" name="login_form">
<input type="hidden" name="loc" value="">
ID: <input type="text" name="id" size="6" maxlength="6" value="l_name"><br>
Password: <input type="password" name="password" size="12" maxlength="12" value="l_pass">
<INPUT TYPE=submit NAME="OKBtn">
</form>

</BODY>
</HTML>
---Paste---

Replace 'l_name' and 'l_pass' with your values. Add the full URL in form.action = "http://.../myacct.asp".
3.Close the file
4.Start the browser with this file

Regards, Geo
0
 
LVL 17

Expert Comment

by:geobul
ID: 2803895
Are you still here ?
0
 

Author Comment

by:clopez
ID: 2805108
Sorry for the delay,
I am still trying to make it work.  For some reason it seem not work when requested from a file or using the webbrowser. Promess to give more info or accept an answer this weekend.
0
 

Author Comment

by:clopez
ID: 2807121
I think the page is detecting where the information page comes from or there is a problem with the page beeing secure.

Anyway, so this doesn't take longer I will accep Serena's aproach as a valid answer, because it was the first person to give an near solution, and also because I think is a better programing solution than geobul.

Also I wuold like to stat that geobul solution may also work in a similar case and I would like to thank all of you for you help.

For future look up the way to pass the parameters with the WebBrowser is:

procedure TForm1.CallURL(URL,Param1,Param2:string);
var Data:string;
   a, b, c, d: OLEVariant;
   i, ib: integer;
   ch: char;
   pp: PChar;

begin
   Data := 'Param1='+ Param1+ '&Param2='+Param2;
   a := 1;
   b := 0;
   ib := Length(Data);
   c := VarArrayCreate([0, ib], 17);
   pp := PChar(Data);
   for i := 0 to ib do
   begin
      ch := pp[i];
      c[i] := ord(ch);
   end;
   d := 'Content-Type: application/x-www-form-urlencoded' + #13 + #10;
   WebBrowser1.Navigate(URL, a, b, c, d);
end;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now