SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <?php |
| 1 | + | |
| 2 | public function index() {
| |
| 3 | ||
| 4 | $this->load->helper('runapi');
| |
| 5 | ||
| 6 | $t['runapi'] = _runApi('https://www.medcom.id/feed/');
| |
| 7 | $parsingrss = $t['runapi']; | |
| 8 | ||
| 9 | $raw = simplexml_load_string($parsingrss, "SimpleXMLElement", LIBXML_NOCDATA); | |
| 10 | $json = json_encode($raw); | |
| 11 | $info = json_decode($json,TRUE); | |
| 12 | ||
| 13 | $item= $info->channel->item; | |
| 14 | ||
| 15 | $image= $info->channel->image; | |
| 16 | //echo $movies->movie[0]->plot; | |
| 17 | $dt0=[ | |
| 18 | strlen($parsingrss), | |
| 19 | count($item), | |
| 20 | $image, | |
| 21 | ]; | |
| 22 | $dt=[]; | |
| 23 | for($i=0;$i<5;$i++){
| |
| 24 | $params=$info['channel']['item'][$i]; | |
| 25 | ||
| 26 | $dt[]= [ | |
| 27 | 'title'=>$params['title'], | |
| 28 | 'link'=>$params['link'], | |
| 29 | 'guid'=>$params['guid'], | |
| 30 | 'description'=>$params['description'] | |
| 31 | ]; | |
| 32 | } | |
| 33 | ||
| 34 | ||
| 35 | echo "<pre>"; | |
| 36 | print_r($parsingrss); | |
| 37 | echo "</pre>"; | |
| 38 | ||
| 39 | ||
| 40 | } | |
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | } |