Php http请求循环未发送
为什么不发送http请求?我正在尝试将登录者的所有好友添加到mysql表中。当我在浏览器中手动使用此url时 它添加值%@,但在我运行objective-c代码时不添加。http请求循环有什么问题Php http请求循环未发送,php,mysql,objective-c,Php,Mysql,Objective C,为什么不发送http请求?我正在尝试将登录者的所有好友添加到mysql表中。当我在浏览器中手动使用此url时 它添加值%@,但在我运行objective-c代码时不添加。http请求循环有什么问题 for (NSDictionary<FBGraphUser>* friend in friends) { NSString *strURL = [NSString stringWithFormat:@"http://www.ratemyplays.com/api/post_fr
for (NSDictionary<FBGraphUser>* friend in friends) {
NSString *strURL = [NSString stringWithFormat:@"http://www.ratemyplays.com/api/post_friends.php?name=%@&id=%@&userid=%@",friend.name, friend.id, currentId];
// to execute php code
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
// to receive the returend value
NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
NSLog(@"%@", strResult);
}
for(NSDictionary*朋友中的朋友){
NSString*strURL=[NSString stringWithFormat:@]http://www.ratemyplays.com/api/post_friends.php?name=%@&id=%@&userid=%@,“friend.name,friend.id,currentId];
//执行php代码
NSData*dataURL=[NSData datawithcontentsofull:[NSURL URLWithString:strURL]];
//接收returend值
NSString*strResult=[[NSString alloc]initWithData:dataURL编码:NSUTF8StringEncoding];
NSLog(@“%@”,strResult);
}
我认为您需要更清楚地了解您在这里想要实现的目标。。nslog打印出来的Url看起来不错。。添加%@是什么意思?在这个外观中,您所做的只是一次又一次地创建一个URL字符串,而没有对它做任何操作 执行NSLog(@“%@”,strURL)
并检查/发布结果发布所有url示例:www.ratemyplays.com/api/post_friends.php?name=Christian Pedersen&id=100007624599560&userid=1386243223我的意思是,如果我把它放在浏览器中,它会将%@%@@一行添加到我的表中。这表明php脚本正在工作。因此,如果在我运行应用程序时没有向表中添加任何内容,则表明http请求工作不正常。