網絡post請求

   //  post請求(代理方式)  

//    NSURL * url = [NSURL URLWithString:@"http://192.168.2.162/logo.php"];

//    

//    //通過URL建立請求對象

//    NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:url];

//    

//    //設置請求方式(默認的是get方式)

//    request.HTTPMethod = @"POST";//使用大寫規範

//    

//    //設置請求參數

////    NSString * str = @"userName=jereh&pwd=123";

//    NSString * str = @"test2.rar";

//    request.HTTPBody = [str dataUsingEncoding:NSUTF8StringEncoding];

//    

//    //創建NSURLConnection 對象用來連接服務器並且發送請求

//    NSURLConnection * conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];

//    [conn start];

//    NSLog(@"%@", [NSThread currentThread]);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章