Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Interfacing with, and getting return values from, a webpage

Reply
Thread Tools

Interfacing with, and getting return values from, a webpage

 
 
David Walker
Guest
Posts: n/a
 
      06-28-2003
Hi
I have a program which I need to interface with a webpage - the webpage will
accept an input (probably a 'post' string from the program) and then will
process it and needs to return a value. Is there an easy way to interface
the program to do this? I have two questions:
How can I call a webpage as simply as possible in c / c++ (preferably not
using MFC etc) and pass a 'post' string to the page?
How can I retrieve an array of values output by the webpage? I can output
them in any format I like since i'm writing the webpage too - I was thinking
just write the output page as a list of variables, basically as dynamically
generated comma separated values data, but i'm not sure whether theres an
easier or quicker way of doing it. Any ideas?
As an added point, I don't want to actually open the webpage so that it is
visible - it should remain hidden, so the user of the program is not aware
of it being there.

Thanks a lot

David


 
Reply With Quote
 
 
 
 
Morris Dovey
Guest
Posts: n/a
 
      06-28-2003
David Walker wrote:

> I have a program which I need to interface with a webpage - the webpage will
> accept an input (probably a 'post' string from the program) and then will
> process it and needs to return a value. Is there an easy way to interface
> the program to do this? I have two questions:



> How can I call a webpage as simply as possible in c / c++ (preferably not
> using MFC etc) and pass a 'post' string to the page?


[Posting from comp.lang.c]

You can't do this in standard C - so this discussion is off-topic
here. You need to ask this question in a newsgroup specific to
your platform and ask about interfacing your client to the
network. I don't think there's anything special that needs to be
done on the server side other than to make sure that there's an
HTML (or possibly plain text) file to retrieve.

> How can I retrieve an array of values output by the webpage? I can output
> them in any format I like since i'm writing the webpage too - I was thinking
> just write the output page as a list of variables, basically as dynamically
> generated comma separated values data, but i'm not sure whether theres an
> easier or quicker way of doing it. Any ideas?


Just issue an HTTP request using that mechanism provided by your
platform. It's easy in a POSIX environment - but may or may not
be in Windows (I don't know).

> As an added point, I don't want to actually open the webpage so that it is
> visible - it should remain hidden, so the user of the program is not aware
> of it being there.


This should make the job easy. Good luck. Please remember to drop
comp.lang.c from further discussion.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

 
Reply With Quote
 
 
 
 
Corey Murtagh
Guest
Posts: n/a
 
      06-28-2003
[follow-ups set to comp.programming since this isn't a language question]

David Walker wrote:

> Hi
> I have a program which I need to interface with a webpage - the webpage will
> accept an input (probably a 'post' string from the program) and then will
> process it and needs to return a value. Is there an easy way to interface
> the program to do this? I have two questions:
> How can I call a webpage as simply as possible in c / c++ (preferably not
> using MFC etc) and pass a 'post' string to the page?


There may be libraries around for making HTTP requests. If you can find
one that you like it'll save you a lot of time and effort doing it yourself.

Otherwise... read up on sockets and HTTP. There are a number of sockets
tutorials around, and the HTTP protocol is well documented in RFC2616.

The most often-quoted networking tutorial might help:

http://www.ecst.csuchico.edu/~beej/g...tml/index.html

> How can I retrieve an array of values output by the webpage? I can output
> them in any format I like since i'm writing the webpage too - I was thinking
> just write the output page as a list of variables, basically as dynamically
> generated comma separated values data, but i'm not sure whether theres an
> easier or quicker way of doing it. Any ideas?


If the page is not designed to be viewed by a browser, then it doesn't
need to be a web page at all. An HTTP server is quite capable of
returning a text document, and if you're backing this with a CGI then
you can just pump whatever text you like out to the client. Your
program can then just process that text as you would any text file.

Alternately you could have a variable in the HTTP query string which
tells the CGI app to produce output in a specific format, with fallback
to displayable HTML if the variable is not present or invalid.

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      06-29-2003
David Walker wrote:
>
> I have a program which I need to interface with a webpage - the
> webpage will accept an input (probably a 'post' string from the
> program) and then will process it and needs to return a value.
> Is there an easy way to interface the program to do this? [snip]


The following query and its returned value should explain why this
is OT on c.l.c. FUPs set.

[1] c:\c\malloc>grep -i -c webpage \stds\n869.txt
0

--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

 
Reply With Quote
 
David Walker
Guest
Posts: n/a
 
      06-29-2003
> > I have a program which I need to interface with a webpage - the
> > webpage will accept an input (probably a 'post' string from the
> > program) and then will process it and needs to return a value.
> > Is there an easy way to interface the program to do this? [snip]

>
> The following query and its returned value should explain why this
> is OT on c.l.c. FUPs set.


So if its so off topic in a C group, how about suggesting somewhere where it
is on-topic then rather than just moaning. I have included
comp.programming, but that seems to be far too general to have a chance of
getting a good response.

David


 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      06-29-2003
David Walker wrote:
>
> > > I have a program which I need to interface with a webpage - the
> > > webpage will accept an input (probably a 'post' string from the
> > > program) and then will process it and needs to return a value.
> > > Is there an easy way to interface the program to do this? [snip]

> >
> > The following query and its returned value should explain why this
> > is OT on c.l.c. FUPs set.

>
> So if its so off topic in a C group, how about suggesting somewhere
> where it is on-topic then rather than just moaning. I have included
> comp.programming, but that seems to be far too general to have a
> chance of getting a good response.


Your deliberate continuance of the off-topic posting will garner
very little other than a plonking, which in turn seriously impedes
your ability to get replies to future on-topic questions. Do you
enter all conversations with screeches to address your unconnected
concerns?

--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


 
Reply With Quote
 
Morris Dovey
Guest
Posts: n/a
 
      06-29-2003
David Walker wrote:
>>> I have a program which I need to interface with a webpage
>>> - the webpage will accept an input (probably a 'post'
>>> string from the program) and then will process it and
>>> needs to return a value. Is there an easy way to interface
>>> the program to do this? [snip]

>>
>> The following query and its returned value should explain
>> why this is OT on c.l.c. FUPs set.

>
> So if its so off topic in a C group, how about suggesting
> somewhere where it is on-topic then rather than just moaning.
> I have included comp.programming, but that seems to be far too
> general to have a chance of getting a good response.


[Again posting from comp.lang.c]

David...

I wrote: "You need to ask this question in a newsgroup specific
to your platform and ask about interfacing your client to the
network."

If you'd like really specific redirection, you'll need to tell us
what platform you're using for the client (Stratus/VOS,
Windows/??, MAC/OS, ...)

<MOAN>
I wasn't moaning. I was giving you the best answer your query
permits (and I /still/ haven't seen platform information.)
</MOAN>
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

 
Reply With Quote
 
Joona I Palaste
Guest
Posts: n/a
 
      06-29-2003
Morris Dovey <(E-Mail Removed)> scribbled the following
on comp.lang.c:
> David Walker wrote:
> >>> I have a program which I need to interface with a webpage
> >>> - the webpage will accept an input (probably a 'post'
> >>> string from the program) and then will process it and
> >>> needs to return a value. Is there an easy way to interface
> >>> the program to do this? [snip]
> >>
> >> The following query and its returned value should explain
> >> why this is OT on c.l.c. FUPs set.

> >
> > So if its so off topic in a C group, how about suggesting
> > somewhere where it is on-topic then rather than just moaning.
> > I have included comp.programming, but that seems to be far too
> > general to have a chance of getting a good response.


> [Again posting from comp.lang.c]


> David...


> I wrote: "You need to ask this question in a newsgroup specific
> to your platform and ask about interfacing your client to the
> network."


> If you'd like really specific redirection, you'll need to tell us
> what platform you're using for the client (Stratus/VOS,
> Windows/??, MAC/OS, ...)


> <MOAN>
> I wasn't moaning. I was giving you the best answer your query
> permits (and I /still/ haven't seen platform information.)
> </MOAN>


He said "preferably not using MFC". MFC stands for Microsoft Foundation
Classes. Now, you'll have to agree that *not* using MFC is pretty easy
on *any* platform you can think of, and on quite many that you can't,
but it is only relevant enough to mention if you happen to be using a
platform that supports MFC, namely Microsoft Windows.

--
/-- Joona Palaste ((E-Mail Removed)) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"The trouble with the French is they don't have a word for entrepreneur."
- George Bush
 
Reply With Quote
 
Morris Dovey
Guest
Posts: n/a
 
      06-29-2003
Joona I Palaste wrote:
> Morris Dovey <(E-Mail Removed)> scribbled the following on
> comp.lang.c:
>
>> David Walker wrote:
>>>>> I have a program which I need to interface with a
>>>>> webpage - the webpage will accept an input (probably a
>>>>> 'post' string from the program) and then will process
>>>>> it and needs to return a value. Is there an easy way
>>>>> to interface the program to do this? [snip]
>>>>
>>>> The following query and its returned value should
>>>> explain why this is OT on c.l.c. FUPs set.
>>>
>>> So if its so off topic in a C group, how about suggesting
>>> somewhere where it is on-topic then rather than just
>>> moaning. I have included comp.programming, but that seems
>>> to be far too general to have a chance of getting a good
>>> response.

>
>> [Again posting from comp.lang.c]

>
>> David...

>
>> I wrote: "You need to ask this question in a newsgroup
>> specific to your platform and ask about interfacing your
>> client to the network."

>
>> If you'd like really specific redirection, you'll need to
>> tell us what platform you're using for the client
>> (Stratus/VOS, Windows/??, MAC/OS, ...)

>
>> <MOAN> I wasn't moaning. I was giving you the best answer
>> your query permits (and I /still/ haven't seen platform
>> information.) </MOAN>

>
> He said "preferably not using MFC". MFC stands for Microsoft
> Foundation Classes. Now, you'll have to agree that *not* using
> MFC is pretty easy on *any* platform you can think of, and on
> quite many that you can't, but it is only relevant enough to
> mention if you happen to be using a platform that supports
> MFC, namely Microsoft Windows.


Joona...

Thanks for straightening me out. Come to think of it, I /have/
heard of Microsoft Foundation Classes (but have never studied or
used 'em in anything I've written.)

Then would news:comp.os.ms-windows.programmer.win32 (from Billy
Chambless' "Welcome to cmp.lang.c" message) be an appropriate
newsgroup for David to pursue his quest? Or are there better?

(I'm beginning to wish I'd just said: "Off topic. Go away!"
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

 
Reply With Quote
 
Malcolm
Guest
Posts: n/a
 
      06-29-2003

"Morris Dovey" <(E-Mail Removed)> wrote in message
>
> Thanks for straightening me out. Come to think of it, I /have/
> heard of Microsoft Foundation Classes (but have never studied or
> used 'em in anything I've written.)
>

MFC is formally a C++ library for writing Windows GUIs, but in fact it is a
point-and-click method of automatically generating code. It is quite
effective in getting complex interfaces up on screen in a short time, but an
MFC program is no longer a human-readable C++ program, and it is part of
Microsoft's wicked plot to destroy C++ and prevent any programs being ported
from Windows to other systems.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cause webpage one to reload when webpage two is closed. Paul ASP .Net 14 06-19-2008 03:02 PM
Clipping a remote webpage with Javascript/XPath and including in a "local" webpage soren625 Javascript 2 12-12-2006 02:09 PM
check if a webpage is forwarding to a other webpage martijn@gamecreators.nl Python 1 09-06-2005 02:27 PM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
Interfacing with, and getting return values from, a webpage David Walker C Programming 12 06-30-2003 10:12 PM



Advertisments