Example #1
0
/**
 * 获取调取百度语音的盾牌
 * @return mixed
 */
function getBdAccess()
{
    $access = S('Bd.access');
    if (!$access) {
        $url = 'https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=rjd6rxuP70kNYCrdDRSXI5N1&client_secret=m0NMxVzubxmSmkdqYCoFXBamThLWV0x3';
        $data = myCurl($url);
        $data = json_decode($data, true);
        S('Bd.access', $data['access_token'], $data['expires_in'] - 1000);
        $access = $data['access_token'];
    }
    return $access;
}
Example #2
0
<?php

echo "Submmit Google Sitemap";
echo "<br>";
$sitemapUrl = HOME_URL . 'sitemap_index.xml';
echo $url = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . urlencode($sitemapUrl);
$returnCode = myCurl($url);
echo "<p>Google Sitemaps has been pinged (return code: {$returnCode}).</p>";
function myCurl($url)
{
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return $httpCode;
}
Example #3
0
 private function creatMp3($text, $pit = 5)
 {
     $access = getBdAccess();
     $url = 'http://tsn.baidu.com/text2audio';
     $data['tex'] = $text;
     $data['lan'] = 'zh';
     $data['tok'] = $access;
     $data['ctp'] = 1;
     $data['cuid'] = session_id();
     $data['pit'] = $pit;
     $param = $this->creatUrl($data);
     $curlset = array(CURLOPT_POST => true, CURLOPT_POSTFIELDS => $param);
     $res = myCurl($url, $curlset);
     return $res;
 }
Example #4
0
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return $httpCode;
}
echo "Starting site submission at " . date('Y-m-d H:i:s') . "\n";
// $argv[0] contains the name of this script.
// We just want the args, so we skip the script name
array_shift($argv);
foreach ($argv as $s) {
    if (filter_var($s, FILTER_VALIDATE_URL) === false) {
        echo "Invalid URL: " . escapeshellarg($s) . " -- skipping\n";
        continue;
    }
    echo "Submitting {$s}\n";
    //Google
    $url = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . $s;
    $returnCode = myCurl($url);
    echo "Google Sitemaps has been pinged (return code: {$returnCode}).\n";
    //Bing / MSN
    $url = "http://www.bing.com/webmaster/ping.aspx?siteMap=" . $s;
    myCurl($url);
    echo "Bing / MSN Sitemaps has been pinged (return code: {$returnCode}).\n";
    //ASK
    $url = "http://submissions.ask.com/ping?sitemap=" . $s;
    myCurl($url);
    echo "ASK.com Sitemaps has been pinged (return code: {$returnCode}).\n";
}
echo "Completed at " . date('Y-m-d H:i:s') . "\n";