ini_set('display_errors', 1);
        if (function_exists('gzdeflate')) {
            echo "Y";
        } else {
            echo "N";
        }
        echo "Testting... cURL<br/>";
        nxs_cURLTest("http://www.nextscripts.com/", "HTTPS to NXS", "Social Networks");
        nxs_cURLTest("http://www.google.com/intl/en/contact/", "HTTP to Google", "Mountain View, CA");
        nxs_cURLTest("https://www.google.com/intl/en/contact/", "HTTPS to Google", "Mountain View, CA");
        nxs_cURLTest("https://www.facebook.com/", "HTTPS to Facebook", 'id="facebook"');
        nxs_cURLTest("https://graph.facebook.com/", "HTTPS to API (Graph) Facebook", 'get');
        nxs_cURLTest("https://www.linkedin.com/nhome/", "HTTPS to LinkedIn", 'rel="canonical" href="https://www.linkedin.com/');
        nxs_cURLTest("https://twitter.com/", "HTTPS to Twitter", '<link rel="canonical" href="https://twitter.com');
        nxs_cURLTest("https://www.pinterest.com/", "HTTPS to Pinterest", 'content="Pinterest"');
        nxs_cURLTest("http://www.livejournal.com/", "HTTP to LiveJournal", '1999 LiveJournal');
        die('Done');
    }
    if (isset($_GET['page']) && $_GET['page'] == 'NextScripts_SNAP.php' && isset($_GET['do']) && $_GET['do'] == 'crtest') {
        if (isset($_GET['redo']) && $_GET['redo'] == '1') {
            delete_option("NXS_cronCheck");
            ?>
<script type="text/javascript">window.location = "<?php 
            echo $nxs_snapSetPgURL;
            ?>
&do=crtest"</script><?php 
        }
        $cr = get_option('NXS_cronCheck');
        if (!empty($cr) && is_array($cr)) {
            $checks = $cr['cronChecks'];
            $numChecks = count($checks);
Example #2
0
function nxs_cURLTest($url, $msg, $testText)
{
    if (!in_array('curl', get_loaded_extensions())) {
        echo "There is a problem with cURL. It is not installed. You need to contact your server admin or hosting provider.";
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
    $response = curl_exec($ch);
    $errmsg = curl_error($ch);
    $cInfo = curl_getinfo($ch);
    curl_close($ch);
    echo "Testing ... " . $url . " - " . $cInfo['url'] . "<br />";
    if (stripos($response, $testText) !== false) {
        echo "...." . $msg . " - OK<br />";
    } else {
        echo "....<b style='color:red;'>" . $msg . " - Problem</b><br /><pre>";
        print_r($errmsg);
        print_r($cInfo);
        print_r(htmlentities($response));
        echo "There is a problem with cURL. You need to contact your server admin or hosting provider.";
    }
}
nxs_cURLTest("http://www.google.com/intl/en/contact/", "HTTP to Google", "Mountain View, CA");
nxs_cURLTest("https://www.google.com/intl/en/contact/", "HTTPS to Google", "Mountain View, CA");
nxs_cURLTest("https://twitter.com/", "HTTPS to Twitter", 'link rel="canonical" href="https://twitter.com/"');
nxs_cURLTest("http://eu.battle.net/api/wow/", "HTTP to BattleNET", "Blizzard");