LoginSignup
0
0

More than 3 years have passed since last update.

webarenaでubuntu その34

Posted at

概要

webarenaでubuntu18.04やってみた。
apache2.4,php7.2やってみた。
rss2jsonやってみた。

インストール

sudo apt-get install php7.2-xml

php.iniの修正。

extension=sinplexml

サンプルコード

<?php
    header("Access-Control-Allow-Origin: *");
    header("Content-Type:  application/json");
    $url = "http:///georss.php";
    $rss = new SimpleXMLElement($url, 0, true);
    $json = json_encode($rss);
    echo $json;
?>

サンプルコード

d3.json('http:///rss2json.php', function(json) {
  var th = ['title', 'desc', 'link'];
  var table = d3.select("body").append("table").attr("border", "1")
table.append("thead").append("tr").selectAll("th").data(th).enter().append("th").text(function(d) {
    return d;
  });
  var w = json.item;
    for (var i = 0; i < w.length; i++)
    {
        var title = w[i].title;
        var desc = w[i].description;
        var link = w[i].link;
        var item = [title, desc, link];
    table.append("tbody").append("tr").selectAll("td").data(item).enter().append("td").text(function(d) {
      return d;
    });
    }
});

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0