title: Do a HTTPResponse in PHP
body: <p>How I can make a HTTPResponse in php? I'm having some trouble :( I should read the response from a cocoa application. This is my php code:</p>
  
  <pre><code>&lt;?php
  HttpResponse::setCache(true);
  HttpResponse::setContentType('text/plain');       
  HttpResponse::setData("Some data");
  HttpResponse::send();
  ?&gt;
  </code></pre>
  
  <p>Then here is my Cocoa Code:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
      [self.view setBackgroundColor:[UIColor whiteColor]];
      NSURL *url = [NSURL URLWithString:@"Web site"];
      NSURLRequest *theRequest=[NSURLRequest requestWithURL:url
                                                cachePolicy:NSURLRequestUseProtocolCachePolicy
                                            timeoutInterval:60.0];
          // create the connection with the request
          // and start loading the data
      NSURLConnection *theConnection=[[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];
      if (theConnection) {
          receivedData = [[[NSMutableData data] retain] autorelease];
          NSLog(@"OK!");
      } else {
          NSLog(@":(((");
      }
  
  }
  
  - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
  {
          // Append the new data to receivedData.
          // receivedData is an instance variable declared elsewhere.
      NSLog(@"DATA");
      NSString* aStr;
      aStr = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
      NSLog(@"%@",aStr);
  }
  </code></pre>
  
  <p>But it doesn't work :( Ideas?</p>