I've been working with an older programmer who's coding an IVR solution. It's running on Windows 2000 and is connected to a T1 (we have internet access) through the machine his code is running on.

I've been trying to get him to request information from our main web server via http post and he doesn't know how to create a http post through C or C++.

He's been wanting to create an object that would run on both of our servers and would listen into TCPIP for a request and save stuff to the folder and bla bla bla bla. I understand what he's trying to do but it would be so much easier to do it via an http request.

Anyone have an idea where I could find something for him to use?

Thank you soooo much for the help :)

Ado

Dani AI

Generated

Brief expert summary and practical next steps.

As described, an IVR running on Windows 2000 that needs to send data to a web server is a very common case for doing an HTTP POST instead of inventing a bespoke TCP protocol. 's suggestion to use a prebuilt client library is the pragmatic route for speed and robustness; 's point about learning Winsock is correct when low-level control or very small dependencies are required. Below is a minimal, clear sketch of how an HTTP POST looks on the wire and a compact checklist to implement it reliably.

Minimal HTTP/1.1 POST (what the server actually expects):

POST /path/on/server HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 19
Connection: close

field1=value1&x=123

Core implementation steps (socket approach)

  • Resolve host and open TCP connection to port 80 (or 443 for HTTPS).
  • Build body (URL-encode form fields or create multipart for files).
  • Construct request lines and headers exactly as above; Content-Length must match bytes in the body.
  • Send request bytes over the socket; read the response until Content-Length bytes are received or until the server closes the connection.
  • Parse the response status line (e.g., HTTP/1.1 200 OK) and headers before reading the body.

Troubleshooting checklist and cautions

  • Common bugs: wrong CRLFs, mismatched Content-Length, forgetting Host header, or not handling chunked transfer-encoding.
  • Test the server behavior first with a simple telnet/netcat session or an HTTP client on another machine to confirm expected request format and response.
  • Network issues: firewall, proxy, or NAT on the T1 host can block outbound HTTP; check routing and proxy settings.
  • For HTTPS, use a library that provides TLS (do not attempt to implement TLS over sockets from scratch). Also confirm the runtime and SSL stack on an older OS supports the needed TLS versions and certificate validation.

This approach keeps the protocol simple and makes it straightforward to replace the socket layer later with a higher-level HTTP client when desired.

Recommended Answers

All 3 Replies

You need to create a network socket with which you can send packets over the TCP/IP protocol. The plain-old method is to use the C functions; for a good guide head over to Beej:
http://beej.us/guide/bgnet/

An easier method, however, is to use a prebuilt wrapper library. One such library is libcurl.

I've been working with an older programmer who's coding an IVR solution. It's running on Windows 2000 and is connected to a T1 (we have internet access) through the machine his code is running on.

I've been trying to get him to request information from our main web server via http post and he doesn't know how to create a http post through C or C++.

He's been wanting to create an object that would run on both of our servers and would listen into TCPIP for a request and save stuff to the folder and bla bla bla bla. I understand what he's trying to do but it would be so much easier to do it via an http request.

Anyone have an idea where I could find something for him to use?

Thank you soooo much for the help :)

Ado

Check this out and it might answer solve some or all of you problems http://msdn2.microsoft.com/en-gb/library/h0ys453x(VS.71).aspx

Socket programming with WSA (Winsock API) or Winsock 2, aka socket programming, is good though so I'd suggest, as joeprogrammer has, you learn that as well. :)

Good luck, LamaBot

good example is

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.