How can i get the downloadable link of uploaded apps in laravel? I want to store the links in mysql. I have used curl to upload apps. Here is my code!
$headers = array("Content-Type: multipart/form-data");
$postfields = array(
"token" => 'IXWEsIpQBRUM4gSDu6f9aLB7W2AEPlsGb2kAJRVmRw',
"file" => new \CurlFile( $filename ),
"find_by_udid" => 0,
"wall_of_apps" => 1
// "callback_email" => ''
);
$ch = curl_init();
$options = array(
CURLOPT_URL => $url,
CURLOPT_HEADER => true,
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $postfields,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36'
);
curl_setopt_array($ch, $options);
curl_exec($ch);
if(!curl_errno($ch))
{
$info = curl_getinfo($ch);
if ($info['http_code'] == 200)
$curl_error = "File uploaded successfully";
}
else
{
$curl_error = curl_error($ch);
}
curl_close($ch);
}
else
{
$curl_error = "Please select the file";
}
echo $curl_error;
It's simple, when your upload succeeds Diawi returns you a Job ID, by which you can create a tracker link and make a GET request on it. There in response you can get the download link (or error message if the file failed Diawi's checks.. wrong format?)
The link format is like
Try this
PS: It's always better to mask your API keys when posting them on Q/A platforms