Poco::Net::HTTPClientSession s("www.cnblogs.com");
//Poco::Net::HTMLForm form;
//form.add("entry1", "value1");
//form.prepareSubmit(request);
s.sendRequest(request);
Poco::Net::HTTPResponse response;
std::istream& rs = s.receiveResponse(response);
std::string responseText;
Poco::StreamCopier copier;
copier.copyToString(rs, responseText);
NSString* strmsg = [NSString stringWithCString:responseText.c_str() encoding:NSUTF8StringEncoding];
NSLog(strmsg);
std::cout << responseText << std::endl;
需要引用的头文件是:
#import <Poco/Net/HTTPClientSession.h>
#import <Poco/Net/HttpRequest.h>
#import <Poco/Net/HttpResponse.h>
#import <Poco/StreamCopier.h>
#import <Poco/Net/HTMLForm.h>
#import <Poco/BinaryReader.h>
#import <string>
//Poco::Net::HTMLForm form;
//form.add("entry1", "value1");
//form.prepareSubmit(request);
s.sendRequest(request);
Poco::Net::HTTPResponse response;
std::istream& rs = s.receiveResponse(response);
std::string responseText;
Poco::StreamCopier copier;
copier.copyToString(rs, responseText);
NSString* strmsg = [NSString stringWithCString:responseText.c_str() encoding:NSUTF8StringEncoding];
NSLog(strmsg);
std::cout << responseText << std::endl;