webview链接 get和post请求传值给链接的页面

get请求

       url = [[ NSURL alloc] initWithString:@"http://www.********.com.cn:8081/index.php/Account/[email protected]&password=1&amount=12"];
       [WebView   loadRequest:[ NSURLRequest requestWithURL: url ]]; //习惯采用loadRequest方式,你可采用其他方式
     
   post请求

       NSURL *url = [NSURL URLWithString: @"http://www.*******.com.cn:8081/index.php/Account/iphoneTopup"];
       NSString *body = [NSString stringWithFormat: @"email=%@&password=%@&amount=%@",@"[email protected]",@"1",@"12"];
       NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL: url];
       [request setHTTPMethod: @"POST"];
       [request setHTTPBody: [body dataUsingEncoding: NSUTF8StringEncoding]];
       [WebView loadRequest: request];

你可能感兴趣的:(webview链接 get和post请求传值给链接的页面)