[iOS开发] 加载webView页面添加POST请求

来源:互联网 发布:阿里云 cdn 域名 编辑:程序博客网 时间:2024/05/24 15:43

    UIWebView * webView = [[UIWebViewalloc]initWithFrame:[[UIScreenmainScreen]bounds]];

    webView.delegate =self;

    NSURL *url = [NSURLURLWithString:@"http://your.url"];

    NSString *body = [NSStringstringWithFormat:@"f=%@&p=%@&t=%@",sec,mob,dateString];

   NSMutableURLRequest *request = [[NSMutableURLRequestalloc]initWithURL: url];

    [request setHTTPMethod:@"POST"];

    [request setHTTPBody: [bodydataUsingEncoding:NSUTF8StringEncoding]];

    [webView loadRequest: request];


0 0
原创粉丝点击