poco之HttpRequest之get方法

Poco::Net::HTTPClientSession s("www.cnblogs.com");

 需要引用的头文件是:

#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::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, "/auroratony/archive/2012/06/06/2537516.html");

    //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;

你可能感兴趣的:(request)