0

私はi電話プログラミングに不慣れです。ユーザー名とパスワードを使用してサーバーにログインできるWebサイトリンクが1つあり、そのデータを取得できます。これで、URLはAspx.net形式になります。以下のコードでサーバーにログインできます。

-(IBAction)buttonClick:(id)sender
{
    TransactionController *t=[[TransactionController alloc]init];
    [self presentModalViewController:t animated:YES];
    NSString* username = nameInput.text;
    NSString* pass = passInput.text;

    if([nameInput.text isEqualToString:@"" ]|| [passInput.text isEqualToString:@""])
    {

        greeting.text = @"Input Your Value";
        [nameInput resignFirstResponder];
        [passInput resignFirstResponder];
        return;
    }

    NSString *post =
    [[NSString alloc] initWithFormat:@"uname=%@&pwd=%@",username,pass];

    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
       NSLog(@"%@",postLength);
    NSURL *url = [NSURL URLWithString:@"http://www.gjhouse.com/login43.aspx"];
      NSLog(@"%@",url);
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
     NSLog(@"This Aslam");
          NSLog(@"%@",theRequest);
    [theRequest setHTTPMethod:@"POST"];
    //[theRequest setValue:postLength forHTTPHeaderField:@"Content-Type"];
    [theRequest setValue:@"text/xml; charset=UTF-8" forHTTPHeaderField:@"Content-type"];
    [theRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPBody:postData];
    NSLog(@"This Aslam");
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

    if( theConnection )
    {
        webData = [NSMutableData data];
    }
    else
    {

    }

    [nameInput resignFirstResponder];
    [passInput resignFirstResponder];
    nameInput.text = nil;
    passInput.text = nil;

}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [webData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{


    [webData appendData:data];
    NSLog(@"%@",webData);
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{

    //[connection release];
   // [webData release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{

    NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
   // NSLog(loginStatus);
       NSLog(@"%@",webData);
    NSLog(@"Hai ");
    greeting.text = loginStatus;
   // [loginStatus release];



    //[connection release];
   // [webData release];
}

ログインすると、以下のようにコンソールにデータが表示されます

2013-03-12 13:32:19.616 Cafezee[366:11303] 23
2013-03-12 13:32:19.621 Cafezee[366:11303] http://www.gjhouse.com/login43.aspx
2013-03-12 13:32:19.624 Cafezee[366:11303] This Aslam
2013-03-12 13:32:19.625 Cafezee[366:11303] <NSMutableURLRequest http://www.gjhouse.com/login43.aspx>
2013-03-12 13:32:19.627 Cafezee[366:11303] This Aslam
2013-03-12 13:32:20.792 Cafezee[366:11303] <0d0a3c21 444f4354 59504520 68746d6c 20505542 4c494320 222d2f2f 5733432f 2f445444 20584854 4d4c2031 2e302054 72616e73 6974696f 6e616c2f 2f454e22 20226874 74703a2f 2f777777 2e77332e 6f72672f 54522f78 68746d6c 312f4454 442f7868 746d6c31 2d747261 6e736974 696f6e61 6c2e6474 64223e0d 0a0d0a3c 68746d6c 20786d6c 6e733d22 68747470 3a2f2f77 77772e77 332e6f72 672f3139 39392f78 68746d6c 223e0d0a 3c686561 64206964 3d224865 61643122 3e3c6c69 6e6b2068 7265663d 22417070 5f546865 6d65732f 44656661 756c742f 674a486f 75736553 74796c65 2e637373 22207479 70653d22 74657874 2f637373 22207265 6c3d2273 74796c65 73686565 7422202f 3e3c7469 746c653e 0d0a094c 6f67696e 20506167 650d0a3c 2f746974 6c653e3c 6c696e6b 2072656c 3d225374 796c6573 68656574 22206872 65663d22 2e2e2f41 70705f54 68656d65 732f4465 6661756c 742f674a 486f7573 65537479 6c652e63 73732220 2f3e3c2f 68656164 3e0d0a0d 0a3c626f 64793e0d 0a202020 203c666f 726d206e 616d653d 22666f72 6d312220 6d657468 6f643d22 706f7374 22206163 74696f6e 3d226c6f 67696e34 332e6173 70782220 69643d22 666f726d 31223e0d 0a3c696e 70757420 74797065 3d226869 6464656e 22206e61 6d653d22 5f5f5649 45575354 41544522 2069643d 225f5f56 49455753 54415445 22207661 6c75653d 222f7745 50447755 4b4c546b 784e6a51 794e7a51 354d4752 6b45776c 66735766 31477a75 7450665a 784b4136 2f776333 5078646f 3d22202f 3e0d0a0d 0a202020 203c6469 763e0d0a 20202020 3c646976 2069643d 2250616e 656c4372 6564656e 7469616c 73223e0d 0a090d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c746162 6c652061 6c69676e 3d226365 6e746572 22207769 6474683d 22343130 22206365 6c6c7370 6163696e 673d2230 22206365 6c6c7061 6464696e 673d2230 2220626f 72646572 3d223022 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20636c61 73733d22 70616765 5f486561 64657222 20636f6c 7370616e 3d223322 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 48656164 6572223e 506c6561 73652065 6e746572 20796f75 72206c6f 67696e20 64657461 696c7320 20202020 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 68656967 68743a20 35707822 3e0d0a20 20202020 20202020 20202020 2020203c 2f74643e 0d0a2020 20202020 20202020 20203c2f 74723e20 200d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 3070783b 2220636c 6173733d 226c6162 656c5f73 74796c65 31222061 6c69676e 3d227269 67687422 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 55736572 4e616d65 2220636c 6173733d 226c6162 656c5f73 74796c65 31223e55 73657220 4e616d65 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 55736572 4e616d65 22207479 70653d22 74657874 22206d61 786c656e 6774683d 22363022 2069643d 22547874 55736572 4e616d65 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e202020 20202020 20202020 20202020 0d0a2020 20202020 20202020 20203c2f 74723e0d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d226865 69676874 3a203570 78223e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e20200d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d227769 6474683a 31303070 783b2220 616c6967 6e3d2272 69676874 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c737061 6e206964 3d224c62 6c506173 73776f72 64222063 6c617373 3d226c61 62656c5f 7374796c 6531223e 50617373 776f7264 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 50617373 776f7264 22207479 70653d22 70617373 776f7264 22206d61 786c656e 6774683d 22323022 2069643d 22547874 50617373 776f7264 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e0d0a20 20202020 20202020 2020203c 2f74723e 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2268 65696768 743a2035 7078223e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e2020 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 616c6967 6e3d2263 656e7465 72222063 6f6c7370 616e3d22 33223e0d 0a202020 20202020 20202020 20202020 20202020 203c696e 70757420 74797065 3d227375 626d6974 22206e61 6d653d22 42746e53 75626d69 74222076 616c7565 3d225375 626d6974 22206f6e 636c6963 6b3d226a 61766173 63726970 743a5765 62466f72 6d5f446f 506f7374 4261636b 57697468 4f707469 6f6e7328 6e657720 57656246 6f726d5f 506f7374 4261636b 4f707469 6f6e7328 2671756f 743b4274 6e537562 6d697426 71756f74 3b2c2026 71756f74 3b267175 6f>
2013-03-12 13:32:21.099 Cafezee[366:11303] <0d0a3c21 444f4354 59504520 68746d6c 20505542 4c494320 222d2f2f 5733432f 2f445444 20584854 4d4c2031 2e302054 72616e73 6974696f 6e616c2f 2f454e22 20226874 74703a2f 2f777777 2e77332e 6f72672f 54522f78 68746d6c 312f4454 442f7868 746d6c31 2d747261 6e736974 696f6e61 6c2e6474 64223e0d 0a0d0a3c 68746d6c 20786d6c 6e733d22 68747470 3a2f2f77 77772e77 332e6f72 672f3139 39392f78 68746d6c 223e0d0a 3c686561 64206964 3d224865 61643122 3e3c6c69 6e6b2068 7265663d 22417070 5f546865 6d65732f 44656661 756c742f 674a486f 75736553 74796c65 2e637373 22207479 70653d22 74657874 2f637373 22207265 6c3d2273 74796c65 73686565 7422202f 3e3c7469 746c653e 0d0a094c 6f67696e 20506167 650d0a3c 2f746974 6c653e3c 6c696e6b 2072656c 3d225374 796c6573 68656574 22206872 65663d22 2e2e2f41 70705f54 68656d65 732f4465 6661756c 742f674a 486f7573 65537479 6c652e63 73732220 2f3e3c2f 68656164 3e0d0a0d 0a3c626f 64793e0d 0a202020 203c666f 726d206e 616d653d 22666f72 6d312220 6d657468 6f643d22 706f7374 22206163 74696f6e 3d226c6f 67696e34 332e6173 70782220 69643d22 666f726d 31223e0d 0a3c696e 70757420 74797065 3d226869 6464656e 22206e61 6d653d22 5f5f5649 45575354 41544522 2069643d 225f5f56 49455753 54415445 22207661 6c75653d 222f7745 50447755 4b4c546b 784e6a51 794e7a51 354d4752 6b45776c 66735766 31477a75 7450665a 784b4136 2f776333 5078646f 3d22202f 3e0d0a0d 0a202020 203c6469 763e0d0a 20202020 3c646976 2069643d 2250616e 656c4372 6564656e 7469616c 73223e0d 0a090d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c746162 6c652061 6c69676e 3d226365 6e746572 22207769 6474683d 22343130 22206365 6c6c7370 6163696e 673d2230 22206365 6c6c7061 6464696e 673d2230 2220626f 72646572 3d223022 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20636c61 73733d22 70616765 5f486561 64657222 20636f6c 7370616e 3d223322 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 48656164 6572223e 506c6561 73652065 6e746572 20796f75 72206c6f 67696e20 64657461 696c7320 20202020 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 68656967 68743a20 35707822 3e0d0a20 20202020 20202020 20202020 2020203c 2f74643e 0d0a2020 20202020 20202020 20203c2f 74723e20 200d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 3070783b 2220636c 6173733d 226c6162 656c5f73 74796c65 31222061 6c69676e 3d227269 67687422 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 55736572 4e616d65 2220636c 6173733d 226c6162 656c5f73 74796c65 31223e55 73657220 4e616d65 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 55736572 4e616d65 22207479 70653d22 74657874 22206d61 786c656e 6774683d 22363022 2069643d 22547874 55736572 4e616d65 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e202020 20202020 20202020 20202020 0d0a2020 20202020 20202020 20203c2f 74723e0d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d226865 69676874 3a203570 78223e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e20200d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d227769 6474683a 31303070 783b2220 616c6967 6e3d2272 69676874 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c737061 6e206964 3d224c62 6c506173 73776f72 64222063 6c617373 3d226c61 62656c5f 7374796c 6531223e 50617373 776f7264 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 50617373 776f7264 22207479 70653d22 70617373 776f7264 22206d61 786c656e 6774683d 22323022 2069643d 22547874 50617373 776f7264 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e0d0a20 20202020 20202020 2020203c 2f74723e 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2268 65696768 743a2035 7078223e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e2020 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 616c6967 6e3d2263 656e7465 72222063 6f6c7370 616e3d22 33223e0d 0a202020 20202020 20202020 20202020 20202020 203c696e 70757420 74797065 3d227375 626d6974 22206e61 6d653d22 42746e53 75626d69 74222076 616c7565 3d225375 626d6974 22206f6e 636c6963 6b3d226a 61766173 63726970 743a5765 62466f72 6d5f446f 506f7374 4261636b 57697468 4f707469 6f6e7328 6e657720 57656246 6f726d5f 506f7374 4261636b 4f707469 6f6e7328 2671756f 743b4274 6e537562 6d697426 71756f74 3b2c2026 71756f74 3b267175 6f743b2c 20747275 652c2026 71756f74 3b267175 6f743b2c 20267175 6f743b26 71756f74 3b2c2066 616c7365 2c206661 6c736529 29222069 643d2242 746e5375 626d6974 2220636c 6173733d 2262746e 5f737479 6c653122 202f3e0d 0a202020 20202020 20202020 20202020 20202020 203c696e 70757420 74797065 3d227375 626d6974 22206e61 6d653d22 42746e43 616e6365 6c222076 616c7565 3d224361 6e63656c 22206f6e 636c6963 6b3d226a 61766173 63726970 743a5765 62466f72 6d5f446f 506f7374 4261636b 57697468 4f707469 6f6e7328 6e657720 57656246 6f726d5f 506f7374 4261636b 4f707469 6f6e7328 2671756f 743b4274 6e43616e 63656c26 71756f74 3b2c2026 71756f74 3b267175 6f743b2c 20747275 652c2026 71756f74 3b267175 6f743b2c 20267175 6f743b26 71756f74 3b2c2066 616c7365 2c206661 6c736529 29222069 643d2242 746e4361 6e63656c 2220636c 6173733d 2262746e 5f737479 6c653122 202f3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 68656967 68743a20 35707822 3e0d0a20 20202020 20202020 20202020 2020203c 2f74643e 0d0a2020 20202020 20202020 20203c2f 74723e20 200d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 20203c74 64207374 796c653d 22776964 74683a32 36307078 3b222061 6c69676e 3d226c65 66742220 636f6c73 70616e3d 22332220 636c6173 733d2265 72726d65 73736167 655f7465 7874223e 0d0a2020 20202020 20202020 20202020 20202020 2020266e 6273703b 3c627220 2f3e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b3c62 72202f3e 0d0a2020 20202020 20202020 20202020 20202020 2020266e 6273703b 20202020 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e0d0a 20202020 20202020 20202020 3c74723e 0d0a2020 20202020 20202020 20202020 20203c74 6420636f 6c737061 6e3d2233 2220616c 69676e3d 2263656e 74657222 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 4d657373 61676522 20636c61 73733d22 6572726d 65737361 67655f74 65787422 3e3c2f73 70616e3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e0d0a 20202020 20202020 3c2f7461 626c653e 0d0a2020 20200d0a 3c2f6469 763e0d0a 20202020 3c2f6469 763e0d0a 20202020 3c2f666f 726d3e0d 0a3c2f62 6f64793e 0d0a3c2f 68746d6c 3e0d0a0d 0a>
2013-03-12 13:32:21.102 Cafezee[366:11303] <0d0a3c21 444f4354 59504520 68746d6c 20505542 4c494320 222d2f2f 5733432f 2f445444 20584854 4d4c2031 2e302054 72616e73 6974696f 6e616c2f 2f454e22 20226874 74703a2f 2f777777 2e77332e 6f72672f 54522f78 68746d6c 312f4454 442f7868 746d6c31 2d747261 6e736974 696f6e61 6c2e6474 64223e0d 0a0d0a3c 68746d6c 20786d6c 6e733d22 68747470 3a2f2f77 77772e77 332e6f72 672f3139 39392f78 68746d6c 223e0d0a 3c686561 64206964 3d224865 61643122 3e3c6c69 6e6b2068 7265663d 22417070 5f546865 6d65732f 44656661 756c742f 674a486f 75736553 74796c65 2e637373 22207479 70653d22 74657874 2f637373 22207265 6c3d2273 74796c65 73686565 7422202f 3e3c7469 746c653e 0d0a094c 6f67696e 20506167 650d0a3c 2f746974 6c653e3c 6c696e6b 2072656c 3d225374 796c6573 68656574 22206872 65663d22 2e2e2f41 70705f54 68656d65 732f4465 6661756c 742f674a 486f7573 65537479 6c652e63 73732220 2f3e3c2f 68656164 3e0d0a0d 0a3c626f 64793e0d 0a202020 203c666f 726d206e 616d653d 22666f72 6d312220 6d657468 6f643d22 706f7374 22206163 74696f6e 3d226c6f 67696e34 332e6173 70782220 69643d22 666f726d 31223e0d 0a3c696e 70757420 74797065 3d226869 6464656e 22206e61 6d653d22 5f5f5649 45575354 41544522 2069643d 225f5f56 49455753 54415445 22207661 6c75653d 222f7745 50447755 4b4c546b 784e6a51 794e7a51 354d4752 6b45776c 66735766 31477a75 7450665a 784b4136 2f776333 5078646f 3d22202f 3e0d0a0d 0a202020 203c6469 763e0d0a 20202020 3c646976 2069643d 2250616e 656c4372 6564656e 7469616c 73223e0d 0a090d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c627220 2f3e0d0a 20202020 20202020 3c746162 6c652061 6c69676e 3d226365 6e746572 22207769 6474683d 22343130 22206365 6c6c7370 6163696e 673d2230 22206365 6c6c7061 6464696e 673d2230 2220626f 72646572 3d223022 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20636c61 73733d22 70616765 5f486561 64657222 20636f6c 7370616e 3d223322 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 48656164 6572223e 506c6561 73652065 6e746572 20796f75 72206c6f 67696e20 64657461 696c7320 20202020 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 68656967 68743a20 35707822 3e0d0a20 20202020 20202020 20202020 2020203c 2f74643e 0d0a2020 20202020 20202020 20203c2f 74723e20 200d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 3070783b 2220636c 6173733d 226c6162 656c5f73 74796c65 31222061 6c69676e 3d227269 67687422 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 55736572 4e616d65 2220636c 6173733d 226c6162 656c5f73 74796c65 31223e55 73657220 4e616d65 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 55736572 4e616d65 22207479 70653d22 74657874 22206d61 786c656e 6774683d 22363022 2069643d 22547874 55736572 4e616d65 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e202020 20202020 20202020 20202020 0d0a2020 20202020 20202020 20203c2f 74723e0d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d226865 69676874 3a203570 78223e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e20200d 0a202020 20202020 20202020 203c7472 3e0d0a20 20202020 20202020 20202020 2020203c 74642073 74796c65 3d227769 6474683a 31303070 783b2220 616c6967 6e3d2272 69676874 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c737061 6e206964 3d224c62 6c506173 73776f72 64222063 6c617373 3d226c61 62656c5f 7374796c 6531223e 50617373 776f7264 203ac2a0 3c2f7370 616e3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2277 69647468 3a333030 70783b22 20616c69 676e3d22 6c656674 223e0d0a 20202020 20202020 20202020 20202020 20202020 3c696e70 7574206e 616d653d 22547874 50617373 776f7264 22207479 70653d22 70617373 776f7264 22206d61 786c656e 6774683d 22323022 2069643d 22547874 50617373 776f7264 2220636c 6173733d 22746578 745f7374 796c6531 22202f3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 77696474 683a3130 70783b22 20616c69 676e3d22 6c656674 2220636c 6173733d 22657272 6d657373 6167655f 74657874 223e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b0d0a 20202020 20202020 20202020 20202020 3c2f7464 3e0d0a20 20202020 20202020 2020203c 2f74723e 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 7374796c 653d2268 65696768 743a2035 7078223e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e2020 0d0a2020 20202020 20202020 20203c74 723e0d0a 20202020 20202020 20202020 20202020 3c746420 616c6967 6e3d2263 656e7465 72222063 6f6c7370 616e3d22 33223e0d 0a202020 20202020 20202020 20202020 20202020 203c696e 70757420 74797065 3d227375 626d6974 22206e61 6d653d22 42746e53 75626d69 74222076 616c7565 3d225375 626d6974 22206f6e 636c6963 6b3d226a 61766173 63726970 743a5765 62466f72 6d5f446f 506f7374 4261636b 57697468 4f707469 6f6e7328 6e657720 57656246 6f726d5f 506f7374 4261636b 4f707469 6f6e7328 2671756f 743b4274 6e537562 6d697426 71756f74 3b2c2026 71756f74 3b267175 6f743b2c 20747275 652c2026 71756f74 3b267175 6f743b2c 20267175 6f743b26 71756f74 3b2c2066 616c7365 2c206661 6c736529 29222069 643d2242 746e5375 626d6974 2220636c 6173733d 2262746e 5f737479 6c653122 202f3e0d 0a202020 20202020 20202020 20202020 20202020 203c696e 70757420 74797065 3d227375 626d6974 22206e61 6d653d22 42746e43 616e6365 6c222076 616c7565 3d224361 6e63656c 22206f6e 636c6963 6b3d226a 61766173 63726970 743a5765 62466f72 6d5f446f 506f7374 4261636b 57697468 4f707469 6f6e7328 6e657720 57656246 6f726d5f 506f7374 4261636b 4f707469 6f6e7328 2671756f 743b4274 6e43616e 63656c26 71756f74 3b2c2026 71756f74 3b267175 6f743b2c 20747275 652c2026 71756f74 3b267175 6f743b2c 20267175 6f743b26 71756f74 3b2c2066 616c7365 2c206661 6c736529 29222069 643d2242 746e4361 6e63656c 2220636c 6173733d 2262746e 5f737479 6c653122 202f3e0d 0a202020 20202020 20202020 20202020 203c2f74 643e0d0a 20202020 20202020 20202020 3c2f7472 3e0d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 203c7464 20737479 6c653d22 68656967 68743a20 35707822 3e0d0a20 20202020 20202020 20202020 2020203c 2f74643e 0d0a2020 20202020 20202020 20203c2f 74723e20 200d0a20 20202020 20202020 2020203c 74723e0d 0a202020 20202020 20202020 20202020 20203c74 64207374 796c653d 22776964 74683a32 36307078 3b222061 6c69676e 3d226c65 66742220 636f6c73 70616e3d 22332220 636c6173 733d2265 72726d65 73736167 655f7465 7874223e 0d0a2020 20202020 20202020 20202020 20202020 2020266e 6273703b 3c627220 2f3e0d0a 20202020 20202020 20202020 20202020 20202020 266e6273 703b3c62 72202f3e 0d0a2020 20202020 20202020 20202020 20202020 2020266e 6273703b 20202020 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e0d0a 20202020 20202020 20202020 3c74723e 0d0a2020 20202020 20202020 20202020 20203c74 6420636f 6c737061 6e3d2233 2220616c 69676e3d 2263656e 74657222 3e0d0a20 20202020 20202020 20202020 20202020 2020203c 7370616e 2069643d 224c626c 4d657373 61676522 20636c61 73733d22 6572726d 65737361 67655f74 65787422 3e3c2f73 70616e3e 0d0a2020 20202020 20202020 20202020 20203c2f 74643e0d 0a202020 20202020 20202020 203c2f74 723e0d0a 20202020 20202020 3c2f7461 626c653e 0d0a2020 20200d0a 3c2f6469 763e0d0a 20202020 3c2f6469 763e0d0a 20202020 3c2f666f 726d3e0d 0a3c2f62 6f64793e 0d0a3c2f 68746d6c 3e0d0a0d 0a>

今私が欲しいのは、JSONまたはXML形式のデータが欲しいということです。それを使用すると、テーブルビューでデータを表示できます。このコードを使用してJsonまたはXmlデータを取得する方法を誰かに教えてもらえますか?

4

1 に答える 1

1

あなたはすでにそれを行っています。

サーバーからデータを取得し、それを NSMutableData オブジェクトに保持して、データを印刷しています。

データを文字列に変換する必要があります。

あなたはそれを次のようにやっていますconnectionDidFinishLoading

NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
NSlog(@"Data : %@",loginStatus);

サーバーが JSON または XML 形式でデータを提供する場合loginStatus、それぞれの形式のデータが含まれます。

于 2013-03-12T08:29:21.613 に答える