By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,583 Members | 3,411 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,583 IT Pros & Developers. It's quick & easy.

Posting to a Web Form and Displaying the Result in Normal Browser

P: n/a
I've been struggling the last two days with something I thought was
very easy, which is to open a web page with a form on it and
populate the form with data passed in a query string (either POST or
GET).

I got Application.FollowHyperlink *kind* of working, but was having
problem with double encoding of some characters (I had to do special
things with + signs in the data, as well as never figuring out why
some data was getting truncated). But I've also had terrible
problems with Access97 just crashing when I execute FollowHyperlink,
as well as getting unspecified object errors.

Runtime Error -2147221020 (800401e4)
Method 'FollowHyperlink' of object '_Application' failed

It may have something to do with the fact that the page is .htaccess
password-protected. It seems to work the first time, prompting for
the password (but using the IE username/password dialog, which seems
odd to me, even though it's opening in FireFox, as it should), and
then it sometimes works a second time (with no password prompt), but
then after that either Access entirely crashes, or it craps out with
the error above.

Even when it worked, I was having problems passing the data, which
is quite complicated with lots of foreign-language characters and
hard returns and such, but was unable to make it reliable with all
my data.

I just did some Googling and came up with this (all on one line):

http://groups.google.com/group/comp..../msg/7ba31bf87
26d8ad0

which suggests that calling FollowHyperlink like this:

Application.FollowHyperlink strURL, , , , strOutput, msoMethodGet

or like this:

Application.FollowHyperlink strURL & strOutput

can crash if strOutput is longer than about 1000 characters and if
(strURL & strOutput) is longer than 2048 characters. I'm very likely
encountering one or both of those limitations, which makes it
unacceptable for use.

Before I discovered that post, I had already turned to XMLHTTP. My
code was copied from posts in the Access newsgroups by lots of you
good folks who know what you are doing. I had already done some
simple proof-of-concept tests, but had original intended to not
display in a web page, but to do it all behind the scenes and not
hand it off to the browser. I had downloaded and installed MSXML4 on
my PC, intending to install it on the target machines, so I figured
I'd use it. But it's not working. Here's my code:

Dim oHttp As Object
Dim strFileName As String

Set oHttp = CreateObject("Microsoft.XMLHTTP")
'oHttp.Open "GET", "https://www.wurlitzerbruck.com/AddRecord.php?" _
& strOutput, False
oHttp.Open "POST", "https://www.wurlitzerbruck.com/AddRecord.php", _
False
oHttp.setRequestHeader "Content-Type", _
"application/x-www-form-urlencoded"
'oHttp.send ' GET
oHttp.send (strOutput) ' POST
'oHttp.send (strXMLOutput) ' POST

strOutput is a standard query string (?Parameter1=1&Parameter2=2,
etc.).

strXMLOutput is the query criteria in XML format.

As shown with the commented-ou code, I also tried using GET, and
that would seem to work, returning the HTML of the target page. But
I don't want that -- I want it to display the page in the default
browser. I'd be fine with using GET for this (though prefer POST),
but don't see how to use this to load it in the default browser.

Any ideas, either on FollowHyperlink or XMLHTTP?

In any event, "upgrade to a newer version of Access" is not an
option for the near future, so don't even mention it. Perhaps an
older version of MSXML would be better? (the choices on the target
machines are 2, 3 and 4). And, BTW, I'm both developing on Win2K and
it will be run on Win2K, all with the latest service packs.

Suggestions?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 5 '07 #1
Share this Question
Share on Google+
13 Replies


P: n/a
On Thu, 05 Apr 2007 18:11:23 -0500, "David W. Fenton"
<XX*******@dfenton.com.invalidwrote:

In cases where I had to poke values into a webpage, I would use the
WebBrowser control, and use the DOM (document object model).
Example:
If WebBrowser1.LocationURL = URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum"). length 0 Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the Login
page.", vbInformation
End If
<clip>
Apr 6 '07 #2

P: n/a
Tom van Stiphout <no*************@cox.netwrote in
news:95********************************@4ax.com:
In cases where I had to poke values into a webpage, I would use
the WebBrowser control, and use the DOM (document object model).
Example:
If WebBrowser1.LocationURL = URL_PHOENIX_LIBRARY_REFERENCE_USA
And
WebBrowser1.Document.getElementsByName("cardnum"). length 0 Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the Login
page.", vbInformation
End If
But the web browser control is disastrously incompatible with A97,
at least, the last time I checked. That was the original way I
conceived this, about 3 or 4 years ago, but could never make it
work, even when I was controlling the version of IE on al installed
machines.

I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have the
script on the website store the data with the session key and return
the session key as its output, then use FollowHyperlink to pass the
session key back to a different script that would open in the
browser and display the data that was passed.

But surely this ought to be doable without persisting data on the
website?

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 7 '07 #3

P: n/a
rkc
David W. Fenton wrote:
Tom van Stiphout <no*************@cox.netwrote in
news:95********************************@4ax.com:
>In cases where I had to poke values into a webpage, I would use
the WebBrowser control, and use the DOM (document object model).
Example:
If WebBrowser1.LocationURL = URL_PHOENIX_LIBRARY_REFERENCE_USA
And
WebBrowser1.Document.getElementsByName("cardnum") .length 0 Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the Login
page.", vbInformation
End If

But the web browser control is disastrously incompatible with A97,
at least, the last time I checked. That was the original way I
conceived this, about 3 or 4 years ago, but could never make it
work, even when I was controlling the version of IE on al installed
machines.

I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have the
script on the website store the data with the session key and return
the session key as its output, then use FollowHyperlink to pass the
session key back to a different script that would open in the
browser and display the data that was passed.

But surely this ought to be doable without persisting data on the
website?

Why do you want to display the data in a web browser?

Is your plan to add items to a database on a web server using an
Access front end and then view how those items are displayed when
requested from the site?

I have done something similar to that for a web store, but did not
view the results in a browser. I used xmhttp to request the page
with the new data and simply parsed it and displayed what I needed
to know in an Access form.

I actually automated the request by item number and just sat there and
watched the results be displayed in the form.


Apr 7 '07 #4

P: n/a
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46***********************@roadrunner.com:
David W. Fenton wrote:
>Tom van Stiphout <no*************@cox.netwrote in
news:95********************************@4ax.com :
>>In cases where I had to poke values into a webpage, I would use
the WebBrowser control, and use the DOM (document object model).
Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum" ).length 0
Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the Login
page.", vbInformation
End If

But the web browser control is disastrously incompatible with
A97, at least, the last time I checked. That was the original way
I conceived this, about 3 or 4 years ago, but could never make it
work, even when I was controlling the version of IE on al
installed machines.

I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have the
script on the website store the data with the session key and
return the session key as its output, then use FollowHyperlink to
pass the session key back to a different script that would open
in the browser and display the data that was passed.

But surely this ought to be doable without persisting data on the
website?

Why do you want to display the data in a web browser?
Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look on
the web page.
Is your plan to add items to a database on a web server using an
Access front end and then view how those items are displayed when
requested from the site?
That's part of it. What is happening is transferring items from the
Access inventory database to the online database that drives the
website. If it were a 1:1 transfer, it would be easy, but everything
has to be extensively processed for the website (it's very complex).
If it were 1:1, I wouldn't be worrying about displaying a confirm.
I have done something similar to that for a web store, but did not
view the results in a browser. I used xmhttp to request the page
with the new data and simply parsed it and displayed what I needed
to know in an Access form.
But I can't do that, because I can't show how it will look on the
web page.
I actually automated the request by item number and just sat there
and watched the results be displayed in the form.
I wish I could do that, but I can't.

I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense to
just add the new record, then display it for confirm/editing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 7 '07 #5

P: n/a
On Apr 7, 6:54 pm, "David W. Fenton" <XXXuse...@dfenton.com.invalid>
wrote:
rkc <r...@rkcny.yabba.dabba.do.comwrote innews:46***********************@roadrunner.com:
David W. Fenton wrote:
Tom van Stiphout <no.spam.tom7...@cox.netwrote in
news:95********************************@4ax.com :
>In cases where I had to poke values into a webpage, I would use
the WebBrowser control, and use the DOM (document object model).
Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum") .length 0
Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the Login
page.", vbInformation
End If
But the web browser control is disastrously incompatible with
A97, at least, the last time I checked. That was the original way
I conceived this, about 3 or 4 years ago, but could never make it
work, even when I was controlling the version of IE on al
installed machines.
I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have the
script on the website store the data with the session key and
return the session key as its output, then use FollowHyperlink to
pass the session key back to a different script that would open
in the browser and display the data that was passed.
But surely this ought to be doable without persisting data on the
website?
Why do you want to display the data in a web browser?

Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look on
the web page.
Is your plan to add items to a database on a web server using an
Access front end and then view how those items are displayed when
requested from the site?

That's part of it. What is happening is transferring items from the
Access inventory database to the online database that drives the
website. If it were a 1:1 transfer, it would be easy, but everything
has to be extensively processed for the website (it's very complex).
If it were 1:1, I wouldn't be worrying about displaying a confirm.
I have done something similar to that for a web store, but did not
view the results in a browser. I used xmhttp to request the page
with the new data and simply parsed it and displayed what I needed
to know in an Access form.

But I can't do that, because I can't show how it will look on the
web page.
I actually automated the request by item number and just sat there
and watched the results be displayed in the form.

I wish I could do that, but I can't.

I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense to
just add the new record, then display it for confirm/editing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Hi, David.

Perhaps one of these approaches might work for you:

Sub SendPost()
Const TempPage = "C:\__tmp\TempPage.htm"

Open TempPage For Output As #1
Print #1, "<html>"
Print #1, "<body " & _
"onLoad=""javascript: document.forms[0].submit();"">"
Print #1, "<form " & _
"action=""http://127.0.0.1/AccessTest/EchoVars.php"" " & _
"method=""POST"">"
Print #1, "<input type=""hidden"" " & _
"name=""foo"" value=""123"">"
Print #1, "<input type=""hidden"" " & _
"name=""bar"" value=""abc"">"
Print #1, "</form>"
Print #1, "</body>"
Print #1, "</html>"
Close #1

Shell "cmd /c ""START " & TempPage & """", vbMinimizedNoFocus

End Sub

Sub SendGet()
Dim strURL As String

' note ampersand in URL is escaped by caret for cmd.exe
strURL = _
"http://127.0.0.1/AccessTest/EchoVars.php?foo=123^&bar=abc"

Shell "cmd /c ""START " & strURL & """", vbMinimizedNoFocus

End Sub

Apr 8 '07 #6

P: n/a
rkc
David W. Fenton wrote:
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46***********************@roadrunner.com:
>David W. Fenton wrote:
>Why do you want to display the data in a web browser?

Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look on
the web page.
>Is your plan to add items to a database on a web server using an
Access front end and then view how those items are displayed when
requested from the site?

That's part of it. What is happening is transferring items from the
Access inventory database to the online database that drives the
website. If it were a 1:1 transfer, it would be easy, but everything
has to be extensively processed for the website (it's very complex).
If it were 1:1, I wouldn't be worrying about displaying a confirm.
In my case I figured if the data was correct in the resulting html
then it should display just fine.

I was processing vendor information from Excel files, cross referencing
it with markup information, specific customer pricing information, and
discount information from a Jet database and writing it to another
Jet database which was then transfered to a MySQL database online.
Not my setup. I was just massaging the data into the desired format.
I suppose so the .php application didn't have to.

The confirmation form was then displaying information from the 2nd Jet
database side by side with what was returned by the website. There was
no real need to view what was actually rendered by a browser.

Any way... good luck working out a solution that makes everyone involved
happy.
Apr 8 '07 #7

P: n/a
"Gord" <gd*@kingston.netwrote in
news:11*********************@l77g2000hsb.googlegro ups.com:
On Apr 7, 6:54 pm, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
>rkc <r...@rkcny.yabba.dabba.do.comwrote
innews:46***********************@roadrunner.com :
David W. Fenton wrote:
Tom van Stiphout <no.spam.tom7...@cox.netwrote in
news:95********************************@4ax.co m:
>>In cases where I had to poke values into a webpage, I would
use the WebBrowser control, and use the DOM (document object
model). Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum" ).length 0
Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the
Login
page.", vbInformation
End If
>But the web browser control is disastrously incompatible with
A97, at least, the last time I checked. That was the original
way I conceived this, about 3 or 4 years ago, but could never
make it work, even when I was controlling the version of IE on
al installed machines.
>I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have
the script on the website store the data with the session key
and return the session key as its output, then use
FollowHyperlink to pass the session key back to a different
script that would open in the browser and display the data
that was passed.
>But surely this ought to be doable without persisting data on
the website?
Why do you want to display the data in a web browser?

Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look
on the web page.
Is your plan to add items to a database on a web server using
an Access front end and then view how those items are displayed
when requested from the site?

That's part of it. What is happening is transferring items from
the Access inventory database to the online database that drives
the website. If it were a 1:1 transfer, it would be easy, but
everything has to be extensively processed for the website (it's
very complex). If it were 1:1, I wouldn't be worrying about
displaying a confirm.
I have done something similar to that for a web store, but did
not view the results in a browser. I used xmhttp to request the
page with the new data and simply parsed it and displayed what
I needed to know in an Access form.

But I can't do that, because I can't show how it will look on the
web page.
I actually automated the request by item number and just sat
there and watched the results be displayed in the form.

I wish I could do that, but I can't.

I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense to
just add the new record, then display it for confirm/editing.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

Hi, David.

Perhaps one of these approaches might work for you:

Sub SendPost()
Const TempPage = "C:\__tmp\TempPage.htm"

Open TempPage For Output As #1
Print #1, "<html>"
Print #1, "<body " & _
"onLoad=""javascript: document.forms[0].submit();"">"
Print #1, "<form " & _
"action=""http://127.0.0.1/AccessTest/EchoVars.php"" " & _
"method=""POST"">"
Print #1, "<input type=""hidden"" " & _
"name=""foo"" value=""123"">"
Print #1, "<input type=""hidden"" " & _
"name=""bar"" value=""abc"">"
Print #1, "</form>"
Print #1, "</body>"
Print #1, "</html>"
Close #1

Shell "cmd /c ""START " & TempPage & """", vbMinimizedNoFocus

End Sub

Sub SendGet()
Dim strURL As String

' note ampersand in URL is escaped by caret for cmd.exe
strURL = _
"http://127.0.0.1/AccessTest/EchoVars.php?foo=123^&bar=abc"

Shell "cmd /c ""START " & strURL & """", vbMinimizedNoFocus

End Sub
No, that won't work, as I need to have it be *server-side*. Your
approach would require running Apache and PHP on the workstation. I
can do that on my own workstation, since I have them installed for
development, but I don't need to have the client doing that.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 8 '07 #8

P: n/a
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
David W. Fenton wrote:
>rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46***********************@roadrunner.com:
>>David W. Fenton wrote:
>>Why do you want to display the data in a web browser?

Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look
on the web page.
>>Is your plan to add items to a database on a web server using an
Access front end and then view how those items are displayed
when requested from the site?

That's part of it. What is happening is transferring items from
the Access inventory database to the online database that drives
the website. If it were a 1:1 transfer, it would be easy, but
everything has to be extensively processed for the website (it's
very complex). If it were 1:1, I wouldn't be worrying about
displaying a confirm.

In my case I figured if the data was correct in the resulting html
then it should display just fine.
Sorry, but I don't understand. It's the data that's the issue, and
it gets reformatted for upload. Right now, that's a batch process,
and it's too hard to do, such that they don't do it very often. I'm
implementing an record-by-record upload (along with a batch upload)
that is automated from the Access application. The need to display
it comes from the fact that only when they see it as it will come
out are they able to evaluate whether they've gotten the data right.

I *could* do it client-side, but as I replied to Gord, that would
require installing Apache and PHP on the two workstations this is
going to run from. I'm not about to do that!
I was processing vendor information from Excel files, cross
referencing it with markup information, specific customer pricing
information, and discount information from a Jet database and
writing it to another Jet database which was then transfered to a
MySQL database online. Not my setup. I was just massaging the data
into the desired format. I suppose so the .php application didn't
have to.

The confirmation form was then displaying information from the 2nd
Jet database side by side with what was returned by the website.
There was no real need to view what was actually rendered by a
browser.
Well, in my case, seeing the final output makes a huge difference.

What I'm going to do is simply use a flag field that already exists
(a TINYINT field) so that the record will be sent as is and appended
to the website database. Then I can easily use FollowHyperlink to
display a PHP page that will return in the browser the editable new
record and the final output.

My original approach was to render the editable data and the final
output without an append to the database, by sending parameters to
the PHP script and having it fill out the form and display the final
results. As that isn't practical, I'll have to do it with appending
*first*. There's one major advantage to that, and I hadn't thought
of it -- I can use the same PHP script for editing any existing
record.

It also occurs to me that the client could then also upload groups
of records and preview their final output, which is something that
we've needed on many an occasion (we use Word merges to preview the
data, but then they can't understand why it looks different on the
website; *sigh* -- this would make it possible to use the actual
website output instead of the Word merge files).

So, in the end, I guess it's an advantage that I can't do it the way
I wanted.

I'm disappointed in the lack of capability of XMLHTTP. Perhaps I
just missed something, but I was never able to really get POST
working with XML data.

And, oh, BTW, the site is:

http://wurlitzerbruck.com

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 8 '07 #9

P: n/a
On Apr 8, 8:46 am, "David W. Fenton" <XXXuse...@dfenton.com.invalid>
wrote:
"Gord" <g...@kingston.netwrote innews:11*********************@l77g2000hsb.googleg roups.com:
On Apr 7, 6:54 pm, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
rkc <r...@rkcny.yabba.dabba.do.comwrote
innews:46***********************@roadrunner.com:
David W. Fenton wrote:
Tom van Stiphout <no.spam.tom7...@cox.netwrote in
news:95********************************@4ax.com :
>In cases where I had to poke values into a webpage, I would
use the WebBrowser control, and use the DOM (document object
model). Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum") .length 0
Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the
Login
page.", vbInformation
End If
But the web browser control is disastrously incompatible with
A97, at least, the last time I checked. That was the original
way I conceived this, about 3 or 4 years ago, but could never
make it work, even when I was controlling the version of IE on
al installed machines.
I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have
the script on the website store the data with the session key
and return the session key as its output, then use
FollowHyperlink to pass the session key back to a different
script that would open in the browser and display the data
that was passed.
But surely this ought to be doable without persisting data on
the website?
Why do you want to display the data in a web browser?
Because I want to have them confirm the add/update, and have the
opportunity to edit if they need, and to preview how it will look
on the web page.
Is your plan to add items to a database on a web server using
an Access front end and then view how those items are displayed
when requested from the site?
That's part of it. What is happening is transferring items from
the Access inventory database to the online database that drives
the website. If it were a 1:1 transfer, it would be easy, but
everything has to be extensively processed for the website (it's
very complex). If it were 1:1, I wouldn't be worrying about
displaying a confirm.
I have done something similar to that for a web store, but did
not view the results in a browser. I used xmhttp to request the
page with the new data and simply parsed it and displayed what
I needed to know in an Access form.
But I can't do that, because I can't show how it will look on the
web page.
I actually automated the request by item number and just sat
there and watched the results be displayed in the form.
I wish I could do that, but I can't.
I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense to
just add the new record, then display it for confirm/editing.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Hi, David.
Perhaps one of these approaches might work for you:
Sub SendPost()
Const TempPage = "C:\__tmp\TempPage.htm"
Open TempPage For Output As #1
Print #1, "<html>"
Print #1, "<body " & _
"onLoad=""javascript: document.forms[0].submit();"">"
Print #1, "<form " & _
"action=""http://127.0.0.1/AccessTest/EchoVars.php"" " & _
"method=""POST"">"
Print #1, "<input type=""hidden"" " & _
"name=""foo"" value=""123"">"
Print #1, "<input type=""hidden"" " & _
"name=""bar"" value=""abc"">"
Print #1, "</form>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
Shell "cmd /c ""START " & TempPage & """", vbMinimizedNoFocus
End Sub
Sub SendGet()
Dim strURL As String
' note ampersand in URL is escaped by caret for cmd.exe
strURL = _
"http://127.0.0.1/AccessTest/EchoVars.php?foo=123^&bar=abc"
Shell "cmd /c ""START " & strURL & """", vbMinimizedNoFocus
End Sub

No, that won't work, as I need to have it be *server-side*. Your
approach would require running Apache and PHP on the workstation. I
can do that on my own workstation, since I have them installed for
development, but I don't need to have the client doing that.
That's right, you don't. The example I posted was from my test machine
where the web server was local. The URL could just as easily have been

https://www.wurlitzerbruck.com/AddRecord.php

or some other remote site. My point was that if you have the _browser_
send the request it can receive the response like any other web
session.

Apr 8 '07 #10

P: n/a
rkc
David W. Fenton wrote:
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
>David W. Fenton wrote:
I'm disappointed in the lack of capability of XMLHTTP. Perhaps I
just missed something, but I was never able to really get POST
working with XML data.
What didn't work? You generally have to urlencode spaces and
any other characters you would have to in an html document if
you are posting it. If you have ever looked at a raw query string
from the server's end you have seen how it's sent by a browser.
Apr 8 '07 #11

P: n/a
"Gord" <gd*@kingston.netwrote in
news:11**********************@e65g2000hsc.googlegr oups.com:
On Apr 8, 8:46 am, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
>"Gord" <g...@kingston.netwrote
innews:11*********************@l77g2000hsb.google groups.com:
On Apr 7, 6:54 pm, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
rkc <r...@rkcny.yabba.dabba.do.comwrote
innews:46***********************@roadrunner.com :
David W. Fenton wrote:
Tom van Stiphout <no.spam.tom7...@cox.netwrote in
news:95********************************@4ax.co m:
>>In cases where I had to poke values into a webpage, I
would use the WebBrowser control, and use the DOM
(document object model). Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum" ).length >
0 Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the
Login
page.", vbInformation
End If
>But the web browser control is disastrously incompatible
with A97, at least, the last time I checked. That was the
original way I conceived this, about 3 or 4 years ago, but
could never make it work, even when I was controlling the
version of IE on al installed machines.
>I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have
the script on the website store the data with the session
key and return the session key as its output, then use
FollowHyperlink to pass the session key back to a different
script that would open in the browser and display the data
that was passed.
>But surely this ought to be doable without persisting data
on the website?
Why do you want to display the data in a web browser?
>Because I want to have them confirm the add/update, and have
the opportunity to edit if they need, and to preview how it
will look on the web page.
Is your plan to add items to a database on a web server
using an Access front end and then view how those items are
displayed when requested from the site?
>That's part of it. What is happening is transferring items
from the Access inventory database to the online database that
drives the website. If it were a 1:1 transfer, it would be
easy, but everything has to be extensively processed for the
website (it's very complex). If it were 1:1, I wouldn't be
worrying about displaying a confirm.
I have done something similar to that for a web store, but
did not view the results in a browser. I used xmhttp to
request the page with the new data and simply parsed it and
displayed what I needed to know in an Access form.
>But I can't do that, because I can't show how it will look on
the web page.
I actually automated the request by item number and just sat
there and watched the results be displayed in the form.
>I wish I could do that, but I can't.
>I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense
to just add the new record, then display it for
confirm/editing.
>--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Hi, David.
Perhaps one of these approaches might work for you:
Sub SendPost()
Const TempPage = "C:\__tmp\TempPage.htm"
Open TempPage For Output As #1
Print #1, "<html>"
Print #1, "<body " & _
"onLoad=""javascript: document.forms[0].submit();"">"
Print #1, "<form " & _
"action=""http://127.0.0.1/AccessTest/EchoVars.php"" " &
_ "method=""POST"">"
Print #1, "<input type=""hidden"" " & _
"name=""foo"" value=""123"">"
Print #1, "<input type=""hidden"" " & _
"name=""bar"" value=""abc"">"
Print #1, "</form>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
Shell "cmd /c ""START " & TempPage & """", vbMinimizedNoFocus
End Sub
Sub SendGet()
Dim strURL As String
' note ampersand in URL is escaped by caret for cmd.exe
strURL = _
"http://127.0.0.1/AccessTest/EchoVars.php?foo=123^&bar=abc"
Shell "cmd /c ""START " & strURL & """", vbMinimizedNoFocus
End Sub

No, that won't work, as I need to have it be *server-side*. Your
approach would require running Apache and PHP on the workstation.
I can do that on my own workstation, since I have them installed
for development, but I don't need to have the client doing that.

That's right, you don't. The example I posted was from my test
machine where the web server was local. The URL could just as
easily have been

https://www.wurlitzerbruck.com/AddRecord.php

or some other remote site. My point was that if you have the
_browser_ send the request it can receive the response like any
other web session.
What are the limits of the parameters passed in a SHELL command?
FollowHyperlink would have worked fine if it weren't for one
argument being limited to c. 1000 characters and the alternative
being limited to 2048. The data I need to send is very often going
to be longer than that, since it's text.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 9 '07 #12

P: n/a
rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46***********************@roadrunner.com:
David W. Fenton wrote:
>rkc <rk*@rkcny.yabba.dabba.do.comwrote in
news:46**********************@roadrunner.com:
>>David W. Fenton wrote:
>I'm disappointed in the lack of capability of XMLHTTP. Perhaps I
just missed something, but I was never able to really get POST
working with XML data.

What didn't work? You generally have to urlencode spaces and
any other characters you would have to in an html document if
you are posting it. If you have ever looked at a raw query string
from the server's end you have seen how it's sent by a browser.
I followed the rules for encoding, but for some reason, the XML
never got to the server. Either that, or I misunderstood something
and should have been parsing the XML into the form on the server.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 9 '07 #13

P: n/a
On Apr 8, 8:13 pm, "David W. Fenton" <XXXuse...@dfenton.com.invalid>
wrote:
"Gord" <g...@kingston.netwrote innews:11**********************@e65g2000hsc.google groups.com:
On Apr 8, 8:46 am, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
"Gord" <g...@kingston.netwrote
innews:11*********************@l77g2000hsb.googleg roups.com:
On Apr 7, 6:54 pm, "David W. Fenton"
<XXXuse...@dfenton.com.invalidwrote:
rkc <r...@rkcny.yabba.dabba.do.comwrote
innews:46***********************@roadrunner.com:
David W. Fenton wrote:
Tom van Stiphout <no.spam.tom7...@cox.netwrote in
news:95********************************@4ax.com :
>In cases where I had to poke values into a webpage, I
would use the WebBrowser control, and use the DOM
(document object model). Example:
If WebBrowser1.LocationURL =
URL_PHOENIX_LIBRARY_REFERENCE_USA And
WebBrowser1.Document.getElementsByName("cardnum") .length >
0 Then
WebBrowser1.Document.All("cardnum").innerText =
LIBRARY_CARD_NUMBER
WebBrowser1.Document.All("cardname").innerText =
LIBRARY_CARD_NAME
WebBrowser1.Document.Forms(0)("Submit").Click
Else
MsgBox "This button only works when you are on the
Login
page.", vbInformation
End If
But the web browser control is disastrously incompatible
with A97, at least, the last time I checked. That was the
original way I conceived this, about 3 or 4 years ago, but
could never make it work, even when I was controlling the
version of IE on al installed machines.
I guess what I could do is the equivalent of some kind of
database-driven session management on the website, and have
the script on the website store the data with the session
key and return the session key as its output, then use
FollowHyperlink to pass the session key back to a different
script that would open in the browser and display the data
that was passed.
But surely this ought to be doable without persisting data
on the website?
Why do you want to display the data in a web browser?
Because I want to have them confirm the add/update, and have
the opportunity to edit if they need, and to preview how it
will look on the web page.
Is your plan to add items to a database on a web server
using an Access front end and then view how those items are
displayed when requested from the site?
That's part of it. What is happening is transferring items
from the Access inventory database to the online database that
drives the website. If it were a 1:1 transfer, it would be
easy, but everything has to be extensively processed for the
website (it's very complex). If it were 1:1, I wouldn't be
worrying about displaying a confirm.
I have done something similar to that for a web store, but
did not view the results in a browser. I used xmhttp to
request the page with the new data and simply parsed it and
displayed what I needed to know in an Access form.
But I can't do that, because I can't show how it will look on
the web page.
I actually automated the request by item number and just sat
there and watched the results be displayed in the form.
I wish I could do that, but I can't.
I guess what I want is not possible without using some kind of
persistent storage on the website. I guess it makes more sense
to just add the new record, then display it for
confirm/editing.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Hi, David.
Perhaps one of these approaches might work for you:
Sub SendPost()
Const TempPage = "C:\__tmp\TempPage.htm"
Open TempPage For Output As #1
Print #1, "<html>"
Print #1, "<body " & _
"onLoad=""javascript: document.forms[0].submit();"">"
Print #1, "<form " & _
"action=""http://127.0.0.1/AccessTest/EchoVars.php"" " &
_ "method=""POST"">"
Print #1, "<input type=""hidden"" " & _
"name=""foo"" value=""123"">"
Print #1, "<input type=""hidden"" " & _
"name=""bar"" value=""abc"">"
Print #1, "</form>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
Shell "cmd /c ""START " & TempPage & """", vbMinimizedNoFocus
End Sub
Sub SendGet()
Dim strURL As String
' note ampersand in URL is escaped by caret for cmd.exe
strURL = _
"http://127.0.0.1/AccessTest/EchoVars.php?foo=123^&bar=abc"
Shell "cmd /c ""START " & strURL & """", vbMinimizedNoFocus
End Sub
No, that won't work, as I need to have it be *server-side*. Your
approach would require running Apache and PHP on the workstation.
I can do that on my own workstation, since I have them installed
for development, but I don't need to have the client doing that.
That's right, you don't. The example I posted was from my test
machine where the web server was local. The URL could just as
easily have been
https://www.wurlitzerbruck.com/AddRecord.php
or some other remote site. My point was that if you have the
_browser_ send the request it can receive the response like any
other web session.

What are the limits of the parameters passed in a SHELL command?
I don't know offhand, but...
FollowHyperlink would have worked fine if it weren't for one
argument being limited to c. 1000 characters and the alternative
being limited to 2048. The data I need to send is very often going
to be longer than that, since it's text.
....if the amount of text you need to send to the server hit those
limits then it could well be that it would also be too big for a Shell
command using a querystring (GET). In that case the POST approach
would be the better candidate because the length of the fully-
qualified path to the temporary HTML file would be the same regardless
of the amount of data to be sent to the server (i.e., written to the
form fields in the HTML file) and that path would almost certainly be
short enough that you could use either Shell or FollowHyperlink.

Apr 9 '07 #14

This discussion thread is closed

Replies have been disabled for this discussion.