Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can research into each of these individual components:</p> <p>1) App make a HTTP POST request to web service with a callback delegate method (ASIHttpRequest or AFNetworking)</p> <p>2) Server receives request, parses it, then constructs a JSON response and return it back to the app automagically (use a web framework)</p> <p>3) In your app's delegate callback method, you will parse the JSON data as a NSDictionary. You extract the JSON key-values using [yourDictionary valueForKey:@"name"];, [yourDictionary valueForKey:@"age"], [yourDictionary valueForKey:@"gender"], [yourDictionary valueForKey:@"email"] etc.</p> <p>Then your app can either show the parsed data on the screen or do other things with it.</p> <h2>EDIT</h2> <p>Since you're using PHP as the web service language, I recommend using Symfony 2 web framework.</p> <p>You'll write something like</p> <pre><code>// get request $inputName = $_REQUEST['name']; // ORM $em = $this-&gt;getDoctrine()-&gt;getManager(); // find email based on name $member = $em-&gt;getRepository('MyWebAppWebServiceBundle:Member')-&gt;findOneByName($inputName); ... // construct JSON array $json = array( 'id' =&gt; $member-&gt;getId(), 'name' =&gt; $member-&gt;getName(), 'email' =&gt; $member-&gt;getEmail() ); // send the response back to the user as JSON data $response = new Response(json_encode($json)); $response-&gt;headers-&gt;set('Content-Type', 'application/json'); return $response; </code></pre> <p>Alternatively, if you want scalable applications, you can use Node.js (server side Javascript)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload