title: POST Request with Swift
body: <p>I'm trying to send data over from my iOS app to a PHP script. I have Title, Description and City. I want it to always save every info I send to it from my iOS app and always make a new one every time I send it data. The problem I'm having is, when I go to the PHP file on my browser, nothing shows up. The title, description and city field is always blank. But in my Xcode console I see it returning everything correctly. Here's my swift code. </p>
  
  <pre><code>func postToServerFunction() {        
          var url: NSURL = NSURL(string: "http://vittletest.netii.net/index.php")!
          var request:NSMutableURLRequest = NSMutableURLRequest(URL:url)
          request.HTTPMethod = "POST"
          let postString = "title=testing&amp;description=hello&amp;city=RanchoCordova"
          request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding)
          let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
              data, response, error in
  
              if error != nil {
                  println("error=\(error)")
                  return
              }
  
              println("response = \(response)")
  
              let responseString = NSString(data: data, encoding: NSUTF8StringEncoding)
              println("responseString = \(responseString)")
          }
          task.resume()
      }
  </code></pre>
  
  <p>And here's my PHP file. </p>
  
  <pre><code>&lt;?php 
      $something = "Some Info";
      echo $something;
  
       $title = $_POST['title'];
       $description = $_POST['description'];
       $city = $_POST['city']; 
  
       echo "&lt;br /&gt;";
       echo "Title: ". $title;  
       echo "&lt;br /&gt;";
       echo "Description: ". $description; 
       echo "&lt;br /&gt;";
       echo "City: ". $city;  
   ?&gt; 
  </code></pre>
  
  <p>And here's my console output on Xcode. </p>
  
  <pre><code>2015-01-03 10:05:50.861 VittleTest[616:28516] Warning: A long-running operation is being executed on the main thread. 
   Break on warnBlockingOperationOnMainThread() to debug.
  response = &lt;NSHTTPURLResponse: 0x7f9f5ae5e3f0&gt; { URL: http://vittletest.netii.net/index.php } { status code: 200, headers {
      Connection = close;
      "Content-Length" = 309;
      "Content-Type" = "text/html";
      Date = "Sat, 03 Jan 2015 18:05:52 GMT";
      Server = Apache;
      "X-Powered-By" = "PHP/5.2.17";
  } }
  responseString = Optional(&lt;html&gt;
   &lt;head&gt;
    &lt;title&gt;PHP Test&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
   Some Info&lt;br /&gt;Title: testing&lt;br /&gt;Description: hello&lt;br /&gt;City: RanchoCordova 
   &lt;/body&gt;
  &lt;/html&gt;
  &lt;!-- Hosting24 Analytics Code --&gt;
  &lt;script type="text/javascript" src="http://stats.hosting24.com/count.php"&gt;&lt;/script&gt;
  &lt;!-- End Of Analytics Code --&gt;
  )
  </code></pre>
  
  <p>I hope I gave you guys enough info to help me out because I can't seem to figure it out since I'm not the best with PHP.</p>