title: CURL: Variables not getting sent
body: <p>I am trying to convert a javascript (Node.js) script to a PHP script. </p>
  
  <pre><code>// Send POST request
          $http({
              method: 'POST',
              url: 'someurl',
              data: $.param($scope.formData),
              headers: {'Content-Type': 'application/x-www-form-urlencoded'}
          })
  </code></pre>
  
  <p>That is the javascript. I have tried to replicate by it by using this code</p>
  
  <pre><code>$url = 'something';
  
  $formData = array( 'code'=&gt;$var);
  $var = 'somethinghere';
  
  $ch = curl_init( $url );
  curl_setopt( $ch, CURLOPT_POST, 1);
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $formData);
  curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt( $ch, CURLOPT_HEADER, 'Content-type: application/x-www-form-urlencoded');
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
  
  $response = curl_exec( $ch );
  echo $response;
  </code></pre>
  
  <p>However, it doesn't work. It doesn't display the data i wanted. It is an external php file (Not hosted by me), i don't understand what i'm doing wrong.</p>