I will give that a shot and get back to you. Thanks.
Main Topics
Browse All TopicsMy company has many products on a popular site. Not sure I want to give the name here, but may have to eventually. Anyway, due to technical problems from a third party they use for processing orders many of our products come down from their site because of us being out of stock, even though we aren't. Long story short, we need to constantly search their site for our products to make sure they are up.
I am assuming I must use their search somehow. They use the following cgi script link from a form on their site (url changed to hide site name).
So basically from within access (preferably) or c++ I would like to search for each of our products that are on their site from our products library (in access) and see if they are up on the site. They use a cgi script to accept data from a form.
Here is the code from their site.
<FORM ACTION="http://www.product
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ID="searchBar">
<TR>
<TD WIDTH="71">
<IMG SRC="http://images.product
</TD>
<TD WIDTH="200" CLASS="searchBoxHolder">
<INPUT NAME="page" TYPE="hidden" VALUE="search">
<INPUT NAME="keyword" TYPE="text" ID="keyword" onClick=this.value=""; VALUE="Search Keyword or Model #" SIZE="30">
</TD>
I had only found 1 question dealing with this using xmlhttp but couldn't get it to work with their cgi script because I didn't know how to pass the value.
Thanks in advance. After I get this working, I will post another question regarding parsing the data.
John
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can use the URLDownloadToFile function in urlmon as well, then read the file within your code. You could even do this one in Access, like:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Sub Command0_Click()
URLDownloadToFile 0, "http://myurl", "c:\local_file.html", 0, 0
End Sub
The access version worked great and I prefer it in access anyway. However, I need to parse out the code that is returned (I will handle this in another question shortly if I don't figure it out).
So my question is, can this be changed to not save the file, but rather assign it to a variable or something else so I can process the file and strip out what I need?
No. If you want to do that, you'll have to read the data directly off of the socket. That would be closer to the earlier example. There's a WinHTTP library that Microsoft has with the platform SDK that you could use in Dev-CPP or Access (with a lot of declare function statements), but it will be much more of a pain. You could also just create a socket connection to port 80 on the server and send the GET function with the HTTP headers, which would not be a big deal either. But it's probably a lot easier just to save it and read in the file (which you could do in Access).
Hmmmm...
Let me explain why I am avoiding the saving thing.
I basically have to check each of our products so see if they are on the site or not. So I have to perform the function say 200 times, each time getting the results and parsing out if it is out of stock or not from the page, then generating some type of report listing each product and the result of that products search.
So, which would you recommend, what would you suggest, and since I am unfamiliar with this, can you get me started?
I really appreciate the help.
Thanks, John
If you're doing it in Access, the URLDownloadToFile will definitely be your safer bet. If you'll be calling it from Access, then chances are you'd have to save it to a file so that Access got the data back anyway (unless you're planning on writing an ActiveX control). It's really up to you. We might be able to get you started, but ultimately you'll have to finish the thing and maintain it. If you're not even the least bit comfortable with C++, but you're comfortable with VBA, then I'd go with the URLDownloadToFile. What do you think?
Well, I am familiar with C++ by not an expert. If it is very complex, then you are correct. As for Access, if there is no other way, then I guess I will have to do the query, save the file, open the file, parse the file, then perform the next query for each product. Just seems like a lot of processing of opening and closing files. I guess I will go with the Access and see how it works. If problems arise in the processing I will revert to another option.
Business Accounts
Answer for Membership
by: mnashadkaPosted on 2005-04-06 at 13:27:25ID: 13721078
The form uses a GET action, so it's going to actually be pretty easy. I'm not sure that you can do it easily in Access, but Visual C++ makes it pretty simple.
/cgi-bin/d 2.cgi?page =search& ke yword=<my search term>
productsit e.com");
ch&keyword =<my search term>");
e))
The URL would be like:
http://www.productsite.com
You can use the CHttpConnection and CHttpFile classes (in afxinet.h) to download this pretty easily. There's the WININET/WINHTTP stuff, but the MFC classes are a little easier. It would look something like:
CInternetSession is("Downloader");
try
{
CHttpConnection *http = is.GetHttpConnection("www.
CHttpFile *web = http->OpenRequest("GET", "/cgi-bin/d2.cgi?page=sear
web->SendRequest();
// Get the data
CString line;
CString data;
while(file->ReadString(lin
{
data += line;
}
// Cleanup
web->Close();
http->Close();
is.Close();
delete web;
delete http;
}
catch(CInternetException *e)
{
e->Delete();
}