Re: How to submit password or ID automatically



"GGL" <GGL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD4C6325-F2D0-4B92-93F6-3AE650455B1B@xxxxxxxxxxxxx
I try to send ID and PW to
http://www.hennlong.idv.tw/cgi-bin/loginout.cgi

The form on this page has a number of <input type="hidden"> fields.
Their corresponding name=value pairs become part of the POST data when
the form is submitted, and the server-side script most like expects to
see them and acts on them. You have to include them in your POST data if
you expect to simulate the exact behavior of the page.

HRESULT CIEPlugin::GetPostData(LPVARIANT pvPostData)
{
HRESULT hr;
LPSAFEARRAY psa;
LPCTSTR cszPostData = L"?inmembername=test&inpassword=testpw";

Remove question mark, it's not needed in POST data.

UINT cElems = lstrlen(cszPostData);

psa = SafeArrayCreateVector(VT_UI1, 0, cElems);
hr = SafeArrayAccessData(psa, (LPVOID*)&pPostData);
memcpy(pPostData, cszPostData, cElems);

You appear to build your program as Unicode. Note that lstrlen gives you
a number of characters, while memcpy expects a number of bytes. In any
case, POST data is expected to be ASCII or UTF-8, not Unicode. Convert
appropriately.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.