Download file using openload api.by this code u get download link from api try this code for download from openload.
Make first file download.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.openload.co/1/file/dlticket?file=XXXXXX&login=XXXXXX&key=XXXXX');
// Set so curl_exec returns the result instead of outputting it.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Get the response and close the channel.
$response = curl_exec($ch);
$json=json_decode($response);
$ticket=$json->result->ticket;
$captcha_url=$json->result->captcha_url;
curl_close($ch);
echo "<img src=$captcha_url>";
?>
<form action="test.php" method="get">
<input type="text" name="captcha">
<br>
<input type="submit" name="submit" value="Submit">
<br>
<?php
echo "<input type=hidden value=$ticket name=ticket>";
?>
</form>
File id can get from upload folder list api or upload api response.
Second file test.php
<?php
if(isset($_GET['captcha']))
{
$captcha=$_GET['captcha'];
$ticket=$_GET['ticket'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.openload.co/1/file/dl?file=4RnbMqWoz8M&ticket=$ticket&captcha_response=$captcha");
// Set so curl_exec returns the result instead of outputting it.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Get the response and close the channel.
$response = curl_exec($ch);
$json=json_decode($response);
echo $json->result->url;
echo "<br>";
curl_close($ch);
}
?>
Comments
Post a Comment