title: PhoneGap Build API : CURL Command Line to PHP
body: <p>I am working on PhoneGap Build API to upload file and create its apk. You can check it here <a href="https://build.phonegap.com/docs/write_api" rel="nofollow">https://build.phonegap.com/docs/write_api</a></p>
  
  <p>I am facing problem in implementing curl using php. The following curl statement on command line is working fine.</p>
  
  <p>$ curl -F file=@/Users/alunny/index.html -u andrew.lunny@nitobi.com -F 'data={"title":"API V1 App","package":"com.alunny.apiv1","version":"0.1.0","create_method":"file"}' <a href="https://build.phonegap.com/api/v1/apps" rel="nofollow">https://build.phonegap.com/api/v1/apps</a></p>
  
  <p>I am getting errors when I try to write this code using php. I have written the following code.</p>
  
  <pre><code>$username = "email";
  $password = "password";
  $target_url = "https://build.phonegap.com/api/v1/apps";
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $target_url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  curl_setopt($ch, CURLOPT_POST, TRUE);
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
  curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  $post = array(
          "file"=&gt;"@www.zip",
          "data"=&gt;json_encode(array("title"=&gt;"My Test App","package"=&gt;"com.alunny.apiv1","version"=&gt;"0.1.0","create_method"=&gt;"file"))
      );
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  
  $result = curl_exec($ch);
  curl_close ($ch);
  </code></pre>
  
  <p>By running this code, I am getting this error "no create_method specified: file, remote_repo, or hosted_repo "</p>
  
  <p>Please help me solving this issue.</p>
  
  <p>Thank you</p>