|
#include <string>
#include <vector>
#include <iostream>
using namespace std;
#include <windows.h>
#include <wininet.h>
#include "web.h"
using namespace openutils;
int main() {
/*char name[51];
char rate[12];
char amt[12];
cout << "Welcome to the On-line interest calculator. " << endl;
cout << "Enter name: ";
gets(name);
cout << "Enter rate: ";
cin >> rate;
cout << "Enter amount: ";
cin >> amt;*/
try {
WebForm wf;
wf.setHost("http://www.belex.rs");
wf.setScriptFile("/srp/akcije.php");
wf.putVariable("t","2");
wf.putVariable("s","AGBN");
wf.putVariable("i","770");
wf.sendRequest();
char buff[1000 * 1024];
if(wf.getResponse(buff,sizeof(buff)-1))
{
cout << buff << endl;
cout << "Response length: " << strlen(buff) << endl;
}
else
{
cout << "No response from server" << endl;
}
return 0;
}catch(WebFormException ex) {
cout << ex.getMessage() << endl;
}
return 0;
}
void test() {
WebForm wf;
// the web server name is set
wf.setHost("http://www.yahoo.com");
// the script to be executed on the web server...
wf.setScriptFile("./");
cout << "Contacting " << wf.getHost() << "..." << endl;
// form variables are added to the request object
// wf.putVariable("name",name);
// wf.putVariable("rate",rate);
// wf.putVariable("amt",amt);
cout << "Sending request..." << endl;
// data is encoded and send to the server script
// for processing
wf.sendRequest();
// reading back any response
char response[400 * 1024];
if(wf.getResponse(response,sizeof(response) - 1)) {
cout << endl << response << endl;
}else {
cout << "No response from server" << endl;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.