- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
目前我正在尝试使用 wp_check_password
来简单地返回 1
或 0
来表示登录是否有效。但是,每当我尝试 require_once
'wp-blog-header.php' 或任何其他 php 文件时,结果是:
Error Domain=AFNetworkingErrorDomain Code=-1011 "Request failed: not found (404)" UserInfo=0xf6c4720 {NSErrorFailingURLKey=http://www.**{site}**.com/BBT/appLogin.php, AFNetworkingOperationFailingURLResponseErrorKey=<NSHTTPURLResponse: 0xf6a5a40> { URL: http://www.**{site}**.com/BBT/appLogin.php } { status code: 404, headers {
"Cache-Control" = "no-cache, must-revalidate, max-age=0";
Connection = close;
"Content-Encoding" = gzip;
"Content-Length" = 21;
"Content-Type" = "text/html; charset=UTF-8";
Date = "Sat, 05 Apr 2014 15:37:26 GMT";
Expires = "Wed, 11 Jan 1984 05:00:00 GMT";
Pragma = "no-cache";
Server = "Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0-fips mod_bwlimited/1.4";
Vary = "Accept-Encoding,User-Agent";
"X-Pingback" = "http://www.**{site}**.com/wp/xmlrpc.php";
"X-Powered-By" = "PHP/5.3.26";} }, NSLocalizedDescription=Request failed: not found (404)}
我的 xcode 函数是:
-(void) submitLogin {
//check information online either show alert or seque to management.
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Info"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager manager] initWithBaseURL:[self.globalVars appBaseStringAsURL]];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
NSDictionary *params = @{@"username": self.usernameTextField.text,
@"password": self.passwordTextField.text};
[manager POST:[self.globalVars appLoginString] parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@",[[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]);
BOOL success = [[[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding] boolValue];
if (success) {
[self performSegueWithIdentifier:@"toEventManagement" sender:self];
} else {
[message setMessage:[NSString stringWithFormat:@"Incorrect login information"]];
[message show];
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@",error);
[message setMessage:[NSString stringWithFormat:@"Error connecting to server"]];
[message show];
}];
我的 php 代码是:
<?php
$username = $password = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
require_once('../wp/wp-blog-header.php');
$username = clean_data($_POST['username']);
$password = clean_data($_POST['password']);
$user = get_user_by('login',$username);
if ( $user and wp_check_password($password, $user->data->user_pass, $user->ID) ){
echo 1;
} else {
echo 0;
}
}
?>
当然,如果有人可以指导我以更好的方式完成这项工作,我将不胜感激。
编辑:与此同时我将只使用异步 NSURLConnection
最佳答案
您是否尝试过 require_once 'wp-load.php' ?那就是对我有用的。我也尝试了 wp-blog-header.php 并得到了同样的错误。 wp-load.php 似乎有效。
关于php - 如何使用 AFNetworking 2.0 检查 Wordpress 登录信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22883063/
有没有人设法通过 AFNetworking 使服务器发送事件 (SSE) 正常工作?我知道 AFURLConnectionOperation 有一个可以附加到的 inputStream 属性,但是 A
在我使用 AFNetworking 发出网络请求之前,有没有办法取消所有网络请求(由另一种方法启动的请求) 我试过如下但不起作用: - (void)sendRequest:(NSUInteger)pa
我同时有一些请求,我想处理直到全部完成。以下是要求: [self getProfileData]; [self checkNewSystemMessage]; [self checkChatMessa
我需要执行一系列按顺序运行的服务器调用,并且只有在所有先前的请求都成功时才能执行一个请求。 所以,我的想法是为每个请求创建一个 AFHTTPRequestOperation 并使用 [myAFHTTP
我正在尝试将 AFNetworking 添加到我的项目中,但我认为我的静态库之一正在使用此框架。我的问题是我该怎么做(将 AFNetworking 添加到我的项目中,最好是不使用 pods)以及我如何
我正在尝试上传一个 NSData,它是使用 AFNetwork 的图像,但出了点问题,我找不到我的错误所在 这是我的代码: NSData *imageData = UIImageJPEGReprese
使用AFNetworking 2.0的应用程序遇到以下问题。 使用AFHTTPRequestOperationManager的GET方法时,出现错误NSURLErrorDomain code -101
你能帮我理解如何使用 UIActivityIndicatorView+AFNetworking 或 UIProgressView+AFNetworking 吗?我是否需要再创建一个 UIViewC
我一直在寻找新的 AFNetworking 2.0 的示例来上传图像。 但是我碰壁了,无法弄清楚代码有什么问题。 所以这是我使用的代码 NSData *imageData = UIImageJPEGR
寻找如何使用 AFHTTPClient 发布 json 的示例.我看到有一个 postPath 方法需要一个 NSDictionary并且 AFJSONEncode 方法返回一个 NSData .是否
在我的项目中,我有 RestKit 和 IDMPhotoBrowser(使用 Cocoapods),所以两个版本 AFNetworking 之间存在冲突。您知道如何在同一个项目中同时使用它们吗? 最佳
我正在尝试为 UIButton 集成 AFNetworking 类(我正在调用配置文件页面并加载异步用户的头像)。 https://gist.github.com/dpettigrew/2925847
我正在尝试将一个项目从 AFNetworking 1.3 迁移到 AFNetworking 2.0。 在 AFNetworking 1.3 项目中,我有以下代码: - (void) downloadJ
我正在使用 AFNetworking 2.0 & 新版本。成功尝试了几个示例 WS 调用。我们已经实现了 Web 服务并被称为: 它的数据参数是加密后的字符串。 请求是:http://demo.XYZ
我正在尝试使用 AFHTTPClient 方法“postPath”将一个参数键的多个值传递给 HTTP 请求。但是,参数变量是 NSDictionary,因此我无法为我的关键“电子邮件”设置多个值。我
当我想停止使用 AFNetworking 构建的同步引擎中的所有当前请求时,我真的遇到了问题。 我有 5 个不同的 URL 可以查询。如果前一个查询被正确执行,则每个查询都会启动。 这非常有效。 我想
我正在制作一个应用程序,它将从网络服务中获取图片资源和文本。我选择了很棒的 AFNetworking 的 UIImageView+AFNetworking 类别来处理图像下载的东西。 但是,我面临着内
我在使用 AFNetworking 时遇到问题代码: #import "SyncProfile.h" #import "AFNetworking.h" @implementation SyncProf
我使用 AFNetworking 作为我的 iPhone 应用程序的网络层,该应用程序连接到使用 Devise 进行身份验证的 Rails 服务器。如果我登录(通过 POST 调用)提供用户名/密码,
iOS 版 AFNetworking 是否提供了缓存失败请求(例如由于没有互联网连接)并在互联网连接恢复时自动重试请求的解决方案。 谢谢,多林 最佳答案 请参阅Network Reachability
我是一名优秀的程序员,十分优秀!