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;
posted on 2012-06-08 17:00  袁晓平  阅读(2085)  评论(0编辑  收藏  举报