コード例 #1
0
ファイル: functions.php プロジェクト: bderudder/oneplus_data
/**
 * Fetch a user stats from API
 *
 * @param $kid invite url or kid
 * @return null|string if kid is valid
 */
function fetchUserStatsFromKid($kid)
{
    $apiInfo = file_get_contents(getWebsiteRoot() . '/api.php?kid=' . $kid);
    if (!strContains($apiInfo, 'error')) {
        return $apiInfo;
    }
    return null;
}
コード例 #2
0
/**
 * Run a PHP script and stop waiting after 2000ms.
 * @param $filename PHP file to execute
 */
function asyncExecuteScript($filename)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, getWebsiteRoot() . '/' . $filename);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT_MS, 2000);
    curl_exec($ch);
    curl_close($ch);
}