🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
9 messages
9 total messages Started by Francisco navarro Tue, 26 Oct 2004 13:13
Post
#1589
Author: Francisco navarro
Date: Tue, 26 Oct 2004 13:13
7 lines
1154 bytes
I can not pass anything with Post
tccpwebbrowser woks fine, navigate, etc.....
but If I pass
    MyControl -> Navigate("the url",NULL,NULL,"usuario=aaaa&password=bbb");
The Url don't get anything......
Hoe can I do it?
thanks
Re: Post
#1591
Author: hans galema
Date: Tue, 26 Oct 2004 13:31
13 lines
1337 bytes
Francisco navarro wrote:
> I can not pass anything with Post
> tccpwebbrowser woks fine, navigate, etc.....
> but If I pass
>     MyControl -> Navigate("the url",NULL,NULL,"usuario=aaaa&password=bbb");
> The Url don't get anything......
> Hoe can I do it?

Have a look at Adam Vieweger/s article
"How to post data using TCppWebBrowser in C++Builder".
http://community.borland.com/article/0,1410,27519,00.html

Hans.
Re: Post
#1592
Author: Francisco navarro
Date: Tue, 26 Oct 2004 13:46
2 lines
1197 bytes
I just copy the code of function in my program, but doesn't work......
I don't know what to do........
Re: Post
#1593
Author: Remy Lebeau (TeamB)
Date: Tue, 26 Oct 2004 16:21
13 lines
1368 bytes
"Francisco navarro" <paconava@telefonica.net> wrote in message
news:417e6e3e@newsgroups.borland.com...

> I just copy the code of function in my program,
> but doesn't work...... I don't know what to do........

Just saying it doesn't work says nothing about the actual problem you are
having.  Please show your actual code.  How do you know what data the server
is expecting in the first place?


Gambit
Re: Post
#1594
Author: Francisco Navarro
Date: Wed, 27 Oct 2004 10:49
60 lines
2733 bytes
I never thought that make an Post was so hard....

I have tried with
    TVariant Datos = "usuario=paco123&password=paco123";
    MyTccpWebBrowser -> Navigate
(http://www.iberware.com/enercut/parametros.php",NULL,NULL,Datos);

    The url is the real url, and the usuario and password are real too. this
pages is made only for try, and it show in screen the
parametros that catch with Get. Is written in asp

I try with with this code too.

void WebPostData(TCppWebBrowser *CppWebBrowser, String sURL, String
sPostData)
{
  BSTR bstrHeaders = NULL;
  TVariant vFlags = {0}, vTargetFrameName={0}, vPostData={0}, vHeaders={0};
  LPSAFEARRAY psa;
  LPCTSTR cszPostData = sPostData.c_str();
  UINT cElems = lstrlen(cszPostData);
  LPSTR pPostData;
  LPVARIANT pvPostData;

  bstrHeaders = SysAllocString(L"Content-Type:
application/x-www-form-urlencodedrn");
  if (!bstrHeaders){
    Application->MessageBox("Could not allocate bstrHeaders", "Warning",
MB_OK | MB_ICONWARNING);
    return;
  }

  V_VT(&vHeaders) = VT_BSTR;
  V_BSTR(&vHeaders) = bstrHeaders;

  pvPostData = vPostData;

  if(pvPostData){
    VariantInit(pvPostData);

    psa = SafeArrayCreateVector(VT_UI1, 0, cElems);
    if(!psa){
      return;
    }

    SafeArrayAccessData(psa, (LPVOID*)&pPostData);
    memcpy(pPostData, cszPostData, cElems);
    SafeArrayUnaccessData(psa);

    V_VT(pvPostData) = VT_ARRAY | VT_UI1;
    V_ARRAY(pvPostData) = psa;
  }

   CppWebBrowser->Navigate((TVariant)sURL, &vFlags, &vTargetFrameName,
&vPostData, &vHeaders);
}

but send noting..

is impossible to pass two string ?
Re: Post
#1595
Author: hans galema
Date: Wed, 27 Oct 2004 12:12
22 lines
1923 bytes
Francisco Navarro wrote:

> I try with with this code too.
> 
> void WebPostData(TCppWebBrowser *CppWebBrowser, String sURL, String
> sPostData)

But you did not show how you called WebPostData() especially
the contents of String sURL. That looks important to me as you
will in one way or the other have to format that String for
different key-value pairs.

The problem for you is that Adam Vieweger in his article
does not show how that has to be done too.

As you will not be the first to try his code you may
expect some comments already. Go to the page again and use
the "View comments" link at the bottom of the page.

If you succeed then please inform us how.

Hans.
Re: Post
#1596
Author: Francisco Navarro
Date: Wed, 27 Oct 2004 15:40
5 lines
1411 bytes
I just call
WebPostData(MtWebControl,http://www.iberware.com/enercut/parametros.php,"act
ion=LogMeIn&usuario=paco123&password=paco123");
I have tried without   action=LogMeIn too, but nothing
You can try it because the page is only for this.
Re: Post
#1597
Author: hans galema
Date: Wed, 27 Oct 2004 16:59
66 lines
3074 bytes
Francisco Navarro wrote:
> I just call
> WebPostData(MtWebControl,http://www.iberware.com/enercut/parametros.php,
 > "action=LogMeIn&usuario=paco123&password=paco123");

Think that "action=LogMeIn" is not done in this way.

> I have tried without   action=LogMeIn too, but nothing
> You can try it because the page is only for this.

Tried it with the following html page.

<html>
<body>
    <form method="post" action 
="http://www.iberware.com/enercut/parametros.php">
      <input name="action" value="LogMeIn">
      <br>
      <input name="usuario" value="paco">
      <br>
      <input name="password" value="123456">
      <input type="Submit" value="Submit form">
    </form>
   <br>
    <form method="post" action 
="http://www.iberware.com/enercut/parametros.php">
      <input name="usuario" value="paco">
      <br>
      <input name="password" value="123456">
      <input type="Submit" value="Submit form">
    </form>
   <br>
    <form method="post" action 
="http://www.iberware.com/enercut/parametros.php?LogMeIn">
      <input name="usuario" value="paco">
      <br>
      <input name="password" value="123456">
      <input type="Submit" value="Submit form">
    </form>
   <br>
    <form method="post" action 
="http://www.iberware.com/enercut/parametros.php/LogMeIn">
      <input name="usuario" value="paco">
      <br>
      <input name="password" value="123456">
      <input type="Submit" value="Submit form">
    </form>
   <br>
   <form method="get" action 
="http://www.iberware.com/enercut/parametros.php">
      <input name="usuario" value="paco">
      <br>
      <input name="password" value="123456">
      <input type="Submit" value="Submit form">
    </form>
</body>
</html>

The page demands the post method. That's for sure.

I did not try with Adam's code.

Why did you not react on my suggestios
for the "View comments" link in the article ?

HAns.
Re: Post
#1600
Author: Francisco navarro
Date: Thu, 28 Oct 2004 14:41
13 lines
1536 bytes
it works fine.....

there was two   \\      that was missing  , in the Headers , but the code of
Adam really works.

Thank you very mach.

Now just have My other big problem:

        I can not send one text file to the USB port, ( is for cutting in a
plotter), in parallel port OK, but not in USB...

well it is another story....
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads