Solved

Posting to an URL

Posted on 2000-05-02
13
242 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
Comment Utility
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
Comment Utility
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
Comment Utility
To craiq capel, your answer doen't send parametes using post method.  I justs opens the explorer
0
 

Author Comment

by:clopez
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry Serega, that doesn't work
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Accepted Solution

by:
Serega earned 200 total points
Comment Utility
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
Comment Utility
Any idea on how to do it?
0
 
LVL 2

Expert Comment

by:Serega
Comment Utility
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
Comment Utility
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
Comment Utility
Are you still here ?
0
 

Author Comment

by:clopez
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 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

14 Experts available now in Live!

Get 1:1 Help Now