微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使HTTP Get请求objective-c

如何解决如何使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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?