Return to Snippet

Revision: 61027
at November 23, 2012 02:01 by code4mac


Initial Code
//SommeBD and other are int 
NSString *post = [NSString stringWithFormat:@"identifiant=%d&sbd=%d&sr=%d&sv=%d&spg=%d", [identifiantUniqueString intValue], sommeBD, sommeR, sommeV, sommePB];
    NSString *hostString = @"http://www.mywebsite/putItInMyDataBase.php?";
    hostString = [hostString stringByAppendingString:post];

    NSData *dataFromURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:hostString] options:NSDataReadingUncached error:&error];
    if(error)
    {
        NSLog(@"%@", [error localizedDescription]);
    }
    else
    {
        NSLog(@"Data had loaded successfully");
    }
    NSString *resultString = [[NSString alloc] initWithData:dataFromURL encoding:NSUTF8StringEncoding];

/* In php code 
<?php

$identifiant = $_GET['identifiant'];
$sommeBD = $_GET['sbd'];
$sommeR = $_GET['sr'];
$sommeV = $_GET['sv'];
$sommePbG = $_GET['spg'];


updateBdd($identifiant, $sommeBD, $sommeR, $sommeV, $sommePG);

echo '0';
?>
*/

Initial URL

                                

Initial Description
pass variables from iOS  app to web site (synchrone version)

Initial Title
pass variables from iOS app to web site

Initial Tags
php

Initial Language
Objective C