如何解决如何使HTTP Get请求objective-c
我有一个主人可以拿走我的钥匙并隐藏支票。 主机显示没有任何请求。
NSMutableuRLRequest *request = [[NSMutableuRLRequest alloc] init];
[request setURL:[NSURL URLWithString:@"http://host/key.PHP?keys=cf7dc026e243bf862d60256099a63e58n2gc49b56d84a2148c130d2c010ff87feb3f&hid=1"]];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];
[[session dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *response,NSError *error) {
Nsstring *requestReply = [[Nsstring alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSLog(@"Request reply: %@",requestReply);
}] resume];
有我的 Key.PHP,在哪里检查密钥和隐藏。 所有服务器代码都写在 PHP 上。 服务器是 MysqL。服务器编码为UTF8
<?PHP
require 'config.PHP';
ob_end_clean();
$response = null;
$license = R::findOne('license',' key_code = ? ',array(
$_GET['keys']
));
if (is_null($license)) $response = set_response(false,400,"Key doesn’t exist");
else if(intval(strtotime($license->data_okonch))==0 || $license->hid == "nulled") $response = set_response(false,"Key zeroed");
else if (intval(strtotime(date("Y-m-d"))) > intval(strtotime($license->data_okonch)))
$response =set_response(false,"License expired");
{
else if (is_null($license->hid))
$license->hid = $_GET['hid'];
R::store($license);
$response = set_response(true,200,"Successful. HID was updated");
}
else if (strval($_GET['hid']) == strval($license->hid)) $response = set_response(true,"Successful,HID wasn’t updated");
else if (strval($_GET['hid']) != strval($license->hid)) $response = set_response(false,"HID doesn’t match");
当我终于发送请求时,我不知道如何发送。我没有改过代码,后来又不行了
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。