Ejemplo n.º 1
0
             $data = array(array('title' => '每日更新,关注最新、经典、热门鬼故事', 'cover' => $web . '/img/ghost.jpg'));
             $note .= '==============================' . "\n" . '回复以上关键字看你想看的鬼故事哟!';
             array_push($data, array('note' => $note));
         } elseif ($ghost[$content]) {
             $res = ghost_story($content);
             $data = array(array('title' => $content, 'cover' => $web . '/img/ghost2.gif'));
             for ($i = 0; $i < count($data); $i++) {
                 if ($res[$i]) {
                     array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => 'http://xiaouri.sinaapp.com/api/ghoststory_read.php?url=' . $res[$i]['link']));
                 }
             }
         } elseif (preg_match('#^张震\\s?(\\d)?#i', $content, $matches)) {
             if (isset($matches[1])) {
                 $data = zhangzhen((int) $matches[1]);
             } else {
                 $data = zhangzhen(rand(0, 49));
             }
         }
     }
 } elseif ($type == 'image') {
     $picurl = $xml->PicUrl;
     $img_data = $f->fetch($picurl);
     if ($f->errno() == 0) {
         $img_name = $openid . date(YmdHis) . '.jpg';
         $s->write('wephoto', $img_name, $img_data);
         $picUrl = $s->getUrl('wephoto', $img_name);
         $mysql->runSql("UPDATE moments SET photo='{$picUrl}' WHERE FromUserName='******'");
         $data = '你的图片已上传成功!';
         $data .= "\n" . picRec($picurl);
     } else {
         $data = 'failed';
Ejemplo n.º 2
0
    } else {
        $result = file_get_contents($url);
        $result = iconv('gb2312', 'gbk', $result);
        $result = iconv('gbk', 'utf-8', $result);
        preg_match_all("/\\<item\\>(.*?)\\<\\/item\\>/s", $result, $items);
        for ($i = 0; $i < 6; $i++) {
            preg_match_all("/\\<title\\>\\<\\!\\[CDATA\\[(.*?)\\]\\]\\>\\<\\/title\\>/", $items[0][$i], $title);
            $title = $title[1][0];
            preg_match_all("/\\<description\\>\\<\\!\\[CDATA\\[(.*?)\\]\\]\\>\\<\\/description\\>/", $items[0][$i], $description);
            $description = $description[1][0];
            preg_match_all("/\\<link\\>(.*?)\\<\\/link\\>/", $items[0][$i], $link);
            $link = $link[1][0];
            preg_match_all("/\\<pubDate\\>(.*?)\\<\\/pubDate\\>/", $items[0][$i], $pubDate);
            $pubDate = $pubDate[1][0];
            preg_match_all("/\\<author\\>(.*?)\\<\\/author\\>/", $items[0][$i], $author);
            $author = $author[1][0];
            array_push($data, array('title' => $title, 'description' => $description, 'link' => $link, 'pubDate' => $pubDate, 'author' => $author));
        }
    }
    return $data;
}
function zhangzhen($i)
{
    $xml = simplexml_load_file('http://www.gui44.com/data/rss/10.xml', 'SimpleXMLElement', LIBXML_NOCDATA);
    preg_match_all('#flashvars="son=(.*?)&amp;autoplay=1&amp;autoreplay=0"#s', file_get_contents($xml->channel->item[$i]->link), $u);
    $title = str_replace(array('张震讲鬼故事系列之', '张震讲鬼故事系列', '张震鬼故事之', '张震讲鬼故事'), '', $xml->channel->item[$i]->title);
    return array('title' => $title, 'description' => '张震', 'musicurl' => $u[1][0], 'HQmusicurl' => $u[1][0]);
}
//print_r(ghost_story());
print_r(zhangzhen((int) '0'));