예제 #1
0
    } else {
        echo json_encode(array('err' => 'Invalid remote url'));
    }
    exit;
}
/**
 * Call back function of cURL handlers
 * when it downloads a file, it works with php >= 5.3.0
 * @param $download_size total file size of the file
 * @param $downloaded total file size that has been downloaded
 * @param $upload_size total file size that has to be uploaded
 * @param $uploadsed total file size that is uploaded
 *
 * Writes the log in file
 */
if (!isCurlInstalled()) {
    exit(json_encode(array("error" => "Sorry, we do not support remote upload")));
}
//checking if user is logged in or not
if (!userid()) {
    exit(json_encode(array('error' => 'You are not logged in')));
}
if ($_POST['youtube']) {
    $youtube_url = $_POST['file'];
    $filename = $_POST['file_name'];
    $ParseUrl = parse_url($youtube_url);
    parse_str($ParseUrl['query'], $youtube_url_prop);
    $YouTubeId = isset($youtube_url_prop['v']) ? $youtube_url_prop['v'] : '';
    if (!$YouTubeId) {
        exit(json_encode(array("error" => "Invalid youtube url")));
    }
예제 #2
0
<?php

// ### Checks for presence of the cURL extension.
function isCurlInstalled()
{
    if (in_array('curl', get_loaded_extensions())) {
        return true;
    } else {
        return false;
    }
    // if-else
}
// _iscurlinstalled
if (isCurlInstalled()) {
    echo "cURL is installed";
} else {
    echo "cURL is NOT installed";
}
?>

<?php 
echo '<pre>';
var_dump(curl_version());
echo '</pre>';
?>

<?php 
// phpinfo is option. Toggle this on or off to your liking.
//phpinfo();
?>