1

Cakephp を使用して Web サービスを作成したアプリケーションを作成しています。http://demo.narolainfotech.com/remindz/users/login.xmlという名前の 1 つの Web サービスがあり、コントローラー フォルダーには、ログインおよび登録機能が記述されている UserController.php という 1 つの Web サービスがあります。このWebサービスに静的な値を入力してこのファイルを解析すると、ログインしたユーザーのデータが適切に取得されますが、xcodeからパラメーターを渡すと、Postデータが解析されません.phpコードprint_r($_POST); 空の配列を表示しています。誰でもこの問題を解決するのを手伝ってくれませんか。前もって感謝します。

私のコードは:

NSString *urlString = [NSString stringWithFormat:@"%s",URL_Login];
request = [[NSMutableURLRequest alloc] init] ;
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];

NSString *contentType = [NSString stringWithFormat:@"application/xml"];
[request addValue:contentType forHTTPHeaderField: @"Content-Type"];

NSMutableData *postBody = [NSMutableData data];
[postBody appendData:[[NSString stringWithFormat:@"<login xmlns=\"\">"] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"<user_email>%@</user_email>",@"raaaavai123_dholakiya@yahoo.co.in"] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"<passWord>%@</passWord>",@"dholakiya"] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"</login>"] dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:postBody];

con = [[NSURLConnection alloc] initWithRequest:request delegate:self];

if(con)
{
    webData = [[NSMutableData data] retain];
}
else
{
    NSLog(@"the Connection is NULL");
}

}

4

0 に答える 0