Return to Snippet

Revision: 60951
at November 19, 2012 04:11 by code4mac


Initial Code
//in iOS code 
NSData *dataFromURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.mywebsite.com/someProgramme.php"] options:NSDataReadingUncached error:&error];
    if(error)
    {
        NSLog(@"%@", [error localizedDescription]);
    }
    else
    {
        NSLog(@"Data had loaded successfully");
        
    }
    NSString *resultString = [[NSString alloc] initWithData:dataFromURL encoding:NSUTF8StringEncoding];
    NSLog(@"result : %@", resultString);

/* 
in php code as a very simple example
<?php
- function someFunction () 
{
     $variable = rand(0,10);
     echo $variable;
}
someFunction();
?>
*/

Initial URL

                                

Initial Description
pass a variable from  web site (in php, in this case) to iOS app.

Initial Title
pass variable from web site to iOS app

Initial Tags
php, ios

Initial Language
Objective C