Hello people. Does anyone know if it is possible to post a variable to a c++ http tunnel or http connection. In php you can do this when you want to qualify someone on an email varification. People do this in a message so when someone clicks on the link to a web site, that link will contain a post variable it looks something like this.

php

href="http://www.someting.com?date=9/15/05&age=21">

I wanted to be able to receive the post from a email click , from a c++ program using an http connection instead of using a whole web site. This is likely possible in my mind. In the the link above that variable date is written in php. I doubt that would work in a c++ http connection does anyone know of this being done in a c++ compatible way, thanks.

Yes thank you for that good code . Do you know how i would write the a href link that i would put in my emails from the example i used above, a link that would be compatible with a c++ socket?

Interesting stuff very new to me, was tough to understand for a minute. So i can use a href with a added value, but it has to be split so that the web site will be read properly?

Currently working on the explanation.
(And you do know you're basically writing a fake web server, right? Awesome.)
(And if you don't have a copy of WireShark, get one. Point it TCP Port 80 and watch the magic happen.)

This is what a GET looks like. (I'll admit I still haven't gotten the hang of which formatting blocks to use for these.)

GET /7357.php?Test=This+is+a+test. HTTP/1.1
Host: prc-web
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP/1.1 200 OK
Date: Sat, 11 Feb 2012 01:11:57 GMT
Server: Apache/2.2.17
Content-Length: 153
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

<html>
	<head>
		<title>
			This is a test.
		</title>
	</head>
	<body>
		<pre>Array
(
    [Test] => This is a test.
)
</pre>
	</body>
</html>

Now for a POST.

POST /7357/index.php HTTP/1.1
Host: prc-web
Connection: keep-alive
Content-Length: 658
Cache-Control: max-age=0
Origin: http://prc-web
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryW9MPp7q6VrfE1jOx
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://prc-web/7357/postTest.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3


------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="String1"

Hello!
------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="string2"

This is a test!
------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="type"

true
------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="string3"

I like hats!
------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="HatsAreAwesome"

true
------WebKitFormBoundaryW9MPp7q6VrfE1jOx
Content-Disposition: form-data; name="submit"

Submit
------WebKitFormBoundaryW9MPp7q6VrfE1jOx--

And the response:

HTTP/1.1 200 OK
Date: Sat, 11 Feb 2012 01:59:15 GMT
Server: Apache/2.2.17
X-Powered-By: PHP/5.3.5
Content-Length: 281
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

<html>
	<head>
		<title>
			This is a test.
		</title>
	</head>
	<body>
		<pre>Array
(
    [String1] => Hello!
    [string2] => This is a test!
    [type] => true
    [string3] => I like hats!
    [HatsAreAwesome] => true
    [submit] => Submit
)
</pre>
	</body>
</html>

The Array you see is just the $_REQUEST variable I used print_r on.

Im not full sure of what you sent me, that looks like an html document. I know php very well, and i know that if you use a href with a variable on the end, you extract it on your web site after the ahref has been click by someone, with the $_REQUEST. I dont have any web site though, thats the point of my post. I want to use an href in a message, with a variable thats for c++ not php. I just got this idea because i used to use php and knew about email validation tecniques. I want to recieve validation from c++ server froma c++ variable in the href, with no web site, and no php. It seems possable that why i braught up using a url connection , so that i could use its GET on the href c++ variable when the link is clicked. If you dont know dont bother though, thanks for your time. I will continue my research.

This article has been dead for over six months. Start a new discussion instead.