title: receive text file from php server to ios app
body: <p>I have created a php server that creates a text file that should be returned to an iOS app, that communicates with it but I have some unsolved questions:</p>
  
  <ol>
  <li>how could I return the text file the was created on the server side using the PHP?</li>
  <li>how to receive the file on the ios app side?</li>
  </ol>
  
  <p>I have defined this code:</p>
  
  <pre><code>[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
   NSString *result = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
  </code></pre>
  
  <p>Here data is the result that should be returned from the server but how could I implement that?</p>
  
  <p>Here is my php file code: </p>
  
  <pre><code>$za = new ZipArchive(); 
  $za-&gt;open('/Applications/XAMPP/xamppfiles/temp/test.zip');  
  $fp = fopen ('/Applications/XAMPP/xamppfiles/temp/myText.txt',"wb");    
  for( $i = 0; $i &lt; $za-&gt;numFiles; $i++ ){ 
      $stat = $za-&gt;statIndex( $i ); 
      print_r( basename( $stat['name'] ) . PHP_EOL );         
      $content = basename( $stat['name'] ) . PHP_EOL ;
  fwrite($fp,$content);
  }
  
  fclose($fp);
  </code></pre>