Article View: borland.public.cppbuilder.internet.web
Article #1006Re: Example With WebPostData
From: caleb
Date: Wed, 19 Oct 2005 17:40
Date: Wed, 19 Oct 2005 17:40
79 lines
3300 bytes
3300 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"caleb" <nospam@nospam.net> wrote in message
>news:43565d65$1@newsgroups.borland.com...
>
>> Even when using the sid value it does not successfully post the data.
>
>Did you do what I told you to do about getting the correct SID value each
>time?
Yes -- definitely using the correct SID value each time.
Here is onbeforenavigate2 data it is adding to a tmemo:
Postdata:
username=bea&password=[removed]&redirect=&login=Log+in
TheURL:
http://gemdev.com/auctions/login.php?sid=6a3e11611bcc35e1636ce9a2b8c67662
TheFlags:
0
TheTargetFrameName:
TheHeaders:
Content-Type: application/x-www-form-urlencoded
--
Tried both \r\n and \r\n\r\n. The former gives headers that match manual form submission.
--
this is what code looks like:
utils.WebPostData(bro,Edit1->Text, // http://gemdev.com/auctions/login.php?sid=6a3e11611bcc35e1636ce9a2b8c67662
Edit2->Text); // username=bea&password=[removed]&redirect=&login=Log+in
// tried both Log+in and Log%20in
//////////// below is from article
::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-urlencoded\r\n");
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);
}
Technical Details
Message-ID:
<4356850c$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!fr.ip.ndsoftware.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4353bb00$1@newsgroups.borland.com> <4353eac7$1@newsgroups.borland.com> <4353f728$1@newsgroups.borland.com> <435410ee@newsgroups.borland.com> <43565d65$1@newsgroups.borland.com> <43567f87@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,ca14d8698db3e7b8 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "caleb" <nospam@nospam.net> Sender: "caleb" <nospam@nospam.net> Reply-To: "caleb" <nospam@nospam.net> Subject: Re: Example With WebPostData Newsgroups: borland.public.cppbuilder.internet.web X-User-Info: 165.247.64.137 References: <4353bb00$1@newsgroups.borland.com> <4353eac7$1@newsgroups.borland.com> <4353f728$1@newsgroups.borland.com> <435410ee@newsgroups.borland.com> <43565d65$1@newsgroups.borland.com> <43567f87@newsgroups.borland.com> NNTP-Posting-Host: 207.105.83.66 Message-ID: <4356850c$1@newsgroups.borland.com> Date: 19 Oct 2005 10:40:28 -0700 X-Trace: newsgroups.borland.com 1129743628 207.105.83.66 (19 Oct 2005 10:40:28 -0700) Lines: 79 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!fr.ip.ndsoftware.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail