PHP Curl Request - Diawi API
<p>I'm struggling to get my Curl request working. The aim of the code is to upload a file to diawi.com using their API. This is my first attempt at using curl, I'm unsure of the correct syntax.</p>

<p>Here is my code:</p>

<pre><code>$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER =&gt; 1,
    CURLOPT_URL =&gt; 'https://upload.diawi.com/',
    CURLOPT_HTTPHEADER =&gt; array(
        "cache-control: no-cache",
        "content-type: multipart/form-data"
    ),
    CURLOPT_USERAGENT =&gt; 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2',
    CURLOPT_POST =&gt; 1,
    CURLOPT_POSTFIELDS =&gt; array(
        token =&gt; 'token',
        file =&gt; 'http://example.com/apps/myapp.ipa',
        find_by_udid =&gt; 0,
        wall_of_apps =&gt; 0,
        callback_url =&gt; 'http://www.example.com/apps/diawi_response.php',
        callback_email =&gt; 'me@company.com'
    )
));

$resp = curl_exec($curl);
curl_close($curl);
echo $resp;
</code></pre>

<p>At the moment the response I'm getting is "No file uploaded".</p>

<p>Here is the example request from the documentation:</p>

<pre><code>$ curl https://upload.diawi.com/ -F token='TOKEN' \
-F file=@MyApp.ipa \
-F find_by_udid=0 \
-F wall_of_apps=1 \
-F password='installation password' \
-F comment='Comment on the build' \
-F callback_url='http://www.example.com/my-diawi-callback-url' \
-F callback_email='me@company.com'
</code></pre>

<p>Any help you can give me would be greatly appreciated.</p>

<p>Test token: MrdS5g9MpZhKn8jlJNuANRlmPuSBkBxWX1LTIptn8p</p>

<p>Test file: <a href="http://defu.se/ESFileExplorer.apk" rel="nofollow">http://defu.se/ESFileExplorer.apk</a></p>