Solved

Posting to an URL

Posted on 2000-05-02
13
254 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 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