如何使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.JdbcOdbc...