Click here to Skip to main content
15,900,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Two port communication Pin
Adam Roderick J26-Aug-09 21:15
Adam Roderick J26-Aug-09 21:15 
AnswerRe: Two port communication Pin
raviteja202026-Aug-09 22:15
raviteja202026-Aug-09 22:15 
GeneralRe: Two port communication Pin
Adam Roderick J26-Aug-09 22:24
Adam Roderick J26-Aug-09 22:24 
AnswerRe: Two port communication Pin
Rajesh R Subramanian26-Aug-09 21:21
professionalRajesh R Subramanian26-Aug-09 21:21 
GeneralRe: Two port communication Pin
raviteja202026-Aug-09 22:22
raviteja202026-Aug-09 22:22 
QuestionRe: Two port communication Pin
David Crow27-Aug-09 3:09
David Crow27-Aug-09 3:09 
AnswerRe: Two port communication Pin
ThatsAlok28-Aug-09 0:48
ThatsAlok28-Aug-09 0:48 
QuestionSubmit a web form: What I'm doing wrong? [modified] Pin
msn9226-Aug-09 20:56
msn9226-Aug-09 20:56 
Hi everybody.

I want to submit a web form. Source of html page:
<html>
<body>

<form action="i.php" method="post">
Name: <input type="text" name="fname" value="MyName" />
Age: <input type="text" name="age" value="17" />
<input type="submit" />
</form>

</body>
</html>

If I submit the form in the page above, I would get:
Welcome MyName!
You are 17 years old. 


And this is my code:
CInternetSession session(L"MyAgent");
CHttpConnection* httpcon=session.GetHttpConnection(L"localhost");
CHttpFile* httpfile=httpcon->OpenRequest(CHttpConnection::HTTP_VERB_POST,L"i.php");
CString headers=L"Content-Type: application/x-www-form-urlencoded";
CString data=L"fname=MyName&age=17";
httpfile->SendRequest(headers,(LPVOID)(LPCTSTR)data,data.GetLength());
CString t=L"";
UINT len=100;
char buf[100];
while(len>0){
	len=httpfile->Read(buf,100);
	if(len>0)t.Append(CString(buf),len);
}
AfxMessageBox(t);
httpfile->Close();
httpcon->Close();
session.Close();


Unfortunately, form is not being submitted. What I'm doing wrong?

I'm trying to do this thing 3rd time now, I don't want to give up this time Big Grin | :-D

Any help would be greatly appreciated.

modified on Thursday, August 27, 2009 6:28 PM

AnswerRe: Submit a web form: What I'm doing wrong? Pin
zhu_lin26-Aug-09 22:10
zhu_lin26-Aug-09 22:10 
AnswerRe: Submit a web form: What I'm doing wrong? Pin
Stuart Dootson26-Aug-09 22:19
professionalStuart Dootson26-Aug-09 22:19 
GeneralRe: Submit a web form: What I'm doing wrong? Pin
msn9227-Aug-09 12:59
msn9227-Aug-09 12:59 
GeneralRe: Submit a web form: What I'm doing wrong? Pin
Stuart Dootson27-Aug-09 13:21
professionalStuart Dootson27-Aug-09 13:21 
GeneralRe: Submit a web form: What I'm doing wrong? Pin
msn9227-Aug-09 13:34
msn9227-Aug-09 13:34 
GeneralRe: Submit a web form: What I'm doing wrong? Pin
Stuart Dootson27-Aug-09 13:52
professionalStuart Dootson27-Aug-09 13:52 
GeneralRe: Submit a web form: What I'm doing wrong? Pin
msn9228-Aug-09 21:34
msn9228-Aug-09 21:34 
QuestionHow to get the list of programs displayed in Windows firewall "Add program" dialog [modified] Pin
Ganesh_T26-Aug-09 20:47
Ganesh_T26-Aug-09 20:47 
GeneralRe: How to get the list of programs displayed in Windows firewall "Add program" dialog Pin
David Crow27-Aug-09 3:45
David Crow27-Aug-09 3:45 
GeneralRe: How to get the list of programs displayed in Windows firewall "Add program" dialog Pin
Ganesh_T27-Aug-09 19:31
Ganesh_T27-Aug-09 19:31 
GeneralRe: How to get the list of programs displayed in Windows firewall "Add program" dialog Pin
David Crow28-Aug-09 2:56
David Crow28-Aug-09 2:56 
GeneralRe: How to get the list of programs displayed in Windows firewall "Add program" dialog Pin
Ganesh_T9-Sep-09 19:32
Ganesh_T9-Sep-09 19:32 
AnswerRe: How to get the list of programs displayed in Windows firewall "Add program" dialog Pin
kilt3-Sep-09 4:52
kilt3-Sep-09 4:52 
Questionhow to get proxy setting of default webbrowser? Pin
Member 383463026-Aug-09 20:38
Member 383463026-Aug-09 20:38 
QuestionOpenFileName Multiselect problem Pin
Chandrasekharan P26-Aug-09 20:17
Chandrasekharan P26-Aug-09 20:17 
AnswerRe: OpenFileName Multiselect problem Pin
Michael Schubert26-Aug-09 20:36
Michael Schubert26-Aug-09 20:36 
AnswerRe: OpenFileName Multiselect problem Pin
Randor 28-Aug-09 6:20
professional Randor 28-Aug-09 6:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.