Skip to content

Instantly share code, notes, and snippets.

@hiroshikuze
Last active December 14, 2019 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroshikuze/281abda8f871c3db3eefa8c3c8ca7495 to your computer and use it in GitHub Desktop.
Save hiroshikuze/281abda8f871c3db3eefa8c3c8ca7495 to your computer and use it in GitHub Desktop.
1.Twitter→2.TWS-Feed 2→(XML)→3.XMLから必要な項目を抽出→4.リンクについて、URLのみ更に抽出→5.リンク先がtwitterになるよう加工→6.ホームページに出力
<?php
$TwitterReaderTemp = simplexml_load_file("http://bit.ly/1uZ74IM");
$TwitterReader = $TwitterReaderTemp -> channel;
$max = (count($TwitterReader) > 5) ? 5: count($TwitterReader);
$i = 0;
foreach($TwitterReader -> item as $Line) {
$title = str_replace("hiroshikuze: ","",$Line -> title);
preg_match("/http:\/\/www.orkut.gmodules.com\/hiroshikuze\/status\/[0-9]*/",$Line -> description,$links);
$link = str_replace("www.orkut.gmodules.com","www.twitter.com",$links[0]);
echo "<ul><li><a href="\"".$link."\"" target="\"_blank\"" data-mce-href="\"".$link."\"">".$title."</a> [".date("Y/m/d H:i", strtotime($Line -> pubDate))."]</li></ul>\n";
$i += 1;
if(4 < $i) { break; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment