473,385 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Interfacing with, and getting return values from, a webpage

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
Jul 19 '05 #1
12 2675
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

Jul 19 '05 #2
[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!"

Jul 19 '05 #3
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 (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Jul 19 '05 #4
> > 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
Jul 19 '05 #5
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 (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Jul 19 '05 #6
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

Jul 19 '05 #7
Morris Dovey <mr*****@iedu.com> 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 (pa*****@cc.helsinki.fi) ---------------------------\
| 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
Jul 19 '05 #8
Joona I Palaste wrote:
Morris Dovey <mr*****@iedu.com> 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!" 8-)
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c

Jul 19 '05 #9

"Morris Dovey" <mr*****@iedu.com> 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.
Jul 19 '05 #10
Malcolm wrote:

"Morris Dovey" <mr*****@iedu.com> 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.


Call that "vendor lockin". It's why MS won't support WTL, an ultra-light MFC
replacement written in some MS engineer's spare time. WTL provides the same
core features as MFC, but without coupling everything together. You can
refactor a WTL program. Hence, MS won't make it an official part of their
VC++ suite.

--
Phlip
http://www.c2.com/cgi/wiki?TestFirstUserInterfaces

Jul 19 '05 #11
dg

"Phlip" <ph******@yahoo.com> wrote in message
news:bd********@dispatch.concentric.net...
Malcolm wrote:

"Morris Dovey" <mr*****@iedu.com> 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.

ya forget mfc if you woant to write a win 32 app learn tha api (strangley
enuff its simplaer then mfc to me cores im writeing asm as well and you just
haf to)
Jul 19 '05 #12
On 29 Jun 2003 17:10:20 GMT, in comp.lang.c , Joona I Palaste
<pa*****@cc.helsinki.fi> wrote:
He said "preferably not using MFC". MFC stands for Microsoft Foundation
Classes.
No it doesn't - MFC is a class A psychedelic.
Now, you'll have to agree that *not* using MFC is pretty easy


ha, you can say that, then obviously you've never had MFC cold
turkey...
:-)

(my point being, MFC is well enough known to windows programmers, but
those of us from other backgrounds might not have a clue waht it is,
adn thus not be able to infer some implementation from it)
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 19 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gowhera Hussain | last post by:
Use This for Learning Only .... Do Not Try To Act Smart HACKING WITH JAVASCRIPT Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC This tutorial is an overview of how javascript can be used to bypass...
3
by: Michael T. Babcock | last post by:
I'm working with databases (MySQL primarily) more and more with Python, and having used PERL in the past for similar work, I'm wondering if there are good tools for doing 'intelligent'...
19
by: Adam Short | last post by:
I am trying to write a routine that will connect a .NET server with a classic ASP server. I know the following code doesn't work! The data is being returned as a dataset, however ASP does not...
2
by: headware | last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design question regarding the use of web services and APS.NET applications. Right now we have an application that uses web services to...
3
by: Michael M | last post by:
All, I have a silly issue that I'd like to handle. I am certain there is a way to do this, but I can't seem to figure it out...so please help. I have to VB6 objects that I'm working with: ...
3
by: Sharon | last post by:
hello all, I was successfull in passing one value from first webpage to second webpage, but not sure how to pass three textbox values from the first page to the second page. Below is the code i...
6
by: eureka | last post by:
Hi friends, I am developing a web application using Jsp and JS. I have a main Jsp page(Jsp1).Inside it I have an iframe having an Html- table which is created dynamically and contains all...
2
by: creative1 | last post by:
hi there, I one question about getting , is this possible that a webpage could not get POSTed values? if yes what should be done to fix that? If I try: echo ($HTTP_POST_VARS); I get following...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.