Example #1
0
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 11:
     $res = bookrank();
     $data = array(array('title' => '读书排行榜', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link']));
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 12:
     $res = matrix67();
     $data = array(array('title' => 'matrix67', 'cover' => $web . '/img/matrix67.png'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link']));
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 13:
     $res = freebuf();
     $data = array(array('title' => 'Freebuf', 'cover' => $web . '/img/freebuf.jpg'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link']));
         }
Example #2
0
<?php

header('Content-type:text/html;charset=utf-8');
function matrix67()
{
    $data = array();
    $url = 'http://www.matrix67.com/blog/feed';
    $result = file_get_contents($url);
    $xml = simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA);
    for ($i = 0; $i < 6; $i++) {
        array_push($data, array('title' => $xml->channel->item[$i]->title, 'description' => str_replace('&#160;', '', $xml->channel->item[$i]->description), 'link' => $xml->channel->item[$i]->link));
    }
    return $data;
}
print_r(matrix67());