Exemplo n.º 1
0
 /**
  * 搜狗搜门搜索
  *
  * @version 16.4.22
  * @link http://top.sogou.com/
  *      
  * @return multitype:string |string
  */
 protected function sogou()
 {
     $sogou = 'http://top.sogou.com/index.html';
     $sogou = wp_remote_get($sogou);
     if (is_wp_error($sogou)) {
         return array('error' => $sogou->get_error_message());
     }
     $sogou = wp_remote_retrieve_body($sogou);
     $sogou = strstr($sogou, '<div class="main_1">');
     $sogou = strstr($sogou, '</div>', true);
     $sogou = idea_get_table($sogou);
     $s['time'] = time();
     foreach ($sogou as $value) {
         $s['kw'][] = strip_tags($value['1']);
     }
     unset($sogou, $value);
     return $s;
 }
Exemplo n.º 2
0
/**
 * 获取imdb电影数据
 *
 * @version 0.13.7.9
 *         
 * @param unknown $type
 * @return Ambigous <string, WP_Error, unknown>
 */
function idea_imdb($type)
{
    switch ($type) {
        case 'box':
            $imdb = wp_remote_retrieve_body(wp_remote_get('http://www.imdb.com/boxoffice/alltimegross?region=world-wide'));
            $imdb = stristr($imdb, '<div id="main">');
            $imdb = stristr($imdb, 'Last update', true);
            break;
        default:
            $imdb = wp_remote_retrieve_body(wp_remote_get('http://www.imdb.com/chart/top'));
            $imdb = stristr($imdb, '<table border="1" cellspacing="0" cellpadding="4">');
            $imdb = stristr($imdb, 'The formula for calculating', true);
            break;
    }
    $imdb = idea_get_table($imdb);
    foreach ($imdb as $k => &$v) {
        switch ($type) {
            case 'top250':
                $v['id'] = substr($v['2'], 68, 9);
                $v['3'] = strip_tags($v['3']);
                break;
            case 'box':
                $v['id'] = substr($v['1'], 16, 9);
                break;
            default:
                break;
        }
        if (!$k) {
            $v['id'] = 'ID';
        }
        $v['0'] = strip_tags($v['0']);
        $v['1'] = strip_tags($v['1']);
        $v['2'] = strip_tags($v['2']);
    }
    unset($k, $v1, $type);
    return $imdb;
}
Exemplo n.º 3
0
     $cu = idea_get_url($ne_url, $option);
     if (stripos($cu, '错误') === 0) {
         echo $cu;
         break;
     }
     $cu = iconv('GBK', 'UTF-8//TRANSLIT', $cu);
     switch (stripos($cu, '<table class="tb01"')) {
         case false:
             $cu = strstr($cu, '<strong id="errMsg">');
             $result[$count]['time'] = substr($cu, 32, stripos($cu, '被充值') - 32);
             $result[$count]['val'] = '已充值';
             break;
         default:
             $cu = strstr($cu, '<table class="tb01"');
             $cu = substr($cu, 0, stripos($cu, '</table>'));
             $cu = idea_get_table($cu);
             if (stripos((string) $cu, '错误') === 0) {
                 echo $cu;
                 break;
             }
             $result[$count]['val'] = $cu['1']['2'];
             $result[$count]['time'] = $cu['1']['3'];
             break;
     }
     $count++;
     sleep(3);
 }
 unset($count);
 ?>
 <table border="1" style="border: thin dashed #F00;">
   <tr>