How to send and receive data to BD Mysql using PHP in Objective-C?

Asked

Viewed 178 times

0

Scenario: Send and receive forms to a Mysql database using PHP.

I wonder if anyone knows or has any link to a didactic and clear tutorial about these procedures, sending and receiving using JSON.

May be in English or Portuguese, and preference for Asynchronous Transfer.

  • Where the question "Objective-c" comes in?

  • Objective-C comes into my work of designing an activity with web service and PHP in my project! I don’t understand why you’re so negative, if you don’t understand you don’t have to deny it, just make a comment.

  • Tiago, we can not know who negative, it may not have been him.

  • Oh no, quiet, I’m not accusing him, in fact are two responses in a comment, as the system removes the empty lines, did not separate the sentences. : D

  • Try this: https://www.youtube.com/watch?v=9x47niEJk_M

  • Very good Kkkkk!!! Jason’s face on the video splash!!! @touchmx

  • I found another very good video and already built the code ( PHP and Objective-c), I will post to the guys here!!! But thanks anyway!

Show 2 more comments

1 answer

0


The solution I found was this! I can send an argument to a php and it returns me the result of the query:

// FUNCIONA PODE SER USADO PARA ENVIAR OS ARGUEMENTOS E RECEBER O RETORNO DA QUERY DO PHP

    NSMutableString* strURL =[[NSMutableString alloc]initWithFormat:@"http://localhost/testesPHP/buscaFuncionarios.php?numero=%@",nomeCadastro.text];


    NSURL* url = [NSURL URLWithString: strURL];


    NSData* data = [NSData dataWithContentsOfURL:url];

    NSError*erro;

    NSMutableArray* oabsRecebidas;

// Recebe o retorno vindo do arquivo PHP buscaFuncionarios.php (no caso usando Json)
    oabsRecebidas = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&erro];

// Escreve na tela o retorno
    NSLog(@"%@", oabsRecebidas);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.