Skip to content

Instantly share code, notes, and snippets.

@Kazunari-h
Created May 30, 2018 12:18
Show Gist options
  • Save Kazunari-h/9fda0c7bc3967f174c189279468589ca to your computer and use it in GitHub Desktop.
Save Kazunari-h/9fda0c7bc3967f174c189279468589ca to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Access Counter</title>
</head>
<body>
<?php
$data = array();
$google_xml = simplexml_load_file('https://trends.google.co.jp/trends/hottrends/atom/feed?pn=p4');
foreach($google_xml->channel as $item){
$x = array();
foreach($item->item as $post){
$x['title'] = (string)$post->title;
$x['description'] = (string)$post->description;
$data[] = $x;
}
}
foreach ($data as $value) {
?>
<h1><?php print $value['title'];?></h1>
<p><?php print $value['description'];?></p>
<hr>
<?php
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment