doutan1637 2014-03-06 16:16
浏览 62


Hi so for my dissertation I'm creating a sports analysis ios app with a website that compliments it. The app does many things but to keep it simple the coach selects the team, and tags any key events e.g tackle, pass etc. The application only shows stats on todays game, but on the website you can see stats from all the games. However I need to find a way to upload those stats

I've found plenty of examples on how to get data from the external database using JSON. However i cant find any example on how to upload data.

I'm using godaddy as my server which hosts my website and sql database.

Any ideas?

  • 写回答

1条回答 默认 最新

  • dqlhsm9820 2014-03-06 18:40

    Let your server (php file) todo the Hard job iOS side: Use something like that to upload POST your values into the server (php file)

        NSString *val1=@"";
        NSString *val2=@"";
        NSString *val3=@"";
        NSString *urlString = [NSString stringWithFormat:@"",val1, val2,val3];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    [request setURL:[NSURL URLWithString:urlString]];
    [request setHTTPMethod:@"POST"];
    NSMutableData *body= [NSMutableData data];
    [request setHTTPBody:body];
    NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:nil];

    Note: use this returnData if you need get something back after your uploading, like success message or some JSON (whatever you want). Just Parse it to your needs.

    On PHP file:

    //GET the values from iOS.
    $val1 = $_GET['value1'];
    $val2 = $_GET['value2'];
    $val3 = $_GET['value3'];
    //connect to database
    require '';
    //just make INSERT SQL Request and done!.

    Hope It's Helping you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 快手联盟怎么快速的跑出建立模型
  • ¥20 ros环境下运行orb-slam一直报错
  • ¥15 关于腾讯云服务器中,PHP页面无法打开的问题
  • ¥60 如何把照片修复成原始拍摄图
  • ¥80 Exited too quickly (process log may have details)
  • ¥15 爬知乎登录之后内容加载不出来
  • ¥15 怎么用protues测量通频带
  • ¥15 zepelin使用sparkInterpreter 异常
  • ¥15 paho mqtt 接收不到消息
  • ¥15 函数r关于两个分量y,z方向上的图像,分开画r随y的图像,r随z的图像