<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ホームページを作る人のまとめ &#187; webアプリ</title>
	<atom:link href="http://www.japan-l.com/design/archives/tag/web%e3%82%a2%e3%83%97%e3%83%aa/feed" rel="self" type="application/rss+xml" />
	<link>http://www.japan-l.com/design</link>
	<description>サイトのデザイン プログラム photoshopのチュートリアル jQuery wordpress ホームページのトレンド Ajax　等ホームページに関するさまざまな情報を紹介していきます。</description>
	<lastBuildDate>Mon, 09 Nov 2009 05:40:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHPとTwitter apiでアプリを作ってみる。</title>
		<link>http://www.japan-l.com/design/archives/170</link>
		<comments>http://www.japan-l.com/design/archives/170#comments</comments>
		<pubDate>Fri, 06 Nov 2009 00:39:47 +0000</pubDate>
		<dc:creator>take</dc:creator>
				<category><![CDATA[twitter]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[webアプリ]]></category>

		<guid isPermaLink="false">http://www.japan-l.com/design/?p=170</guid>
		<description><![CDATA[まずはTwitterへの登録が必要みたい。
※APIを使用するにはメールアドレスとパスワードが必要。
早速 サンプル用Twitterを登録してみる。
まずは簡単に表示できるかチェックしてみようってことで、
Twitter 仕様書を参考にPHPで作ってみた。
Twitter APIのサンプル
サンプルコードはコチラから
&#60;html&#62;
&#60;head&#62;
&#60;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&#62;
&#60;title&#62;Twitter API サンプル&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
&#60;h1&#62;Twitter API サンプル&#60;/h1&#62;
&#60;?php
//ユーザーIDとパスワードの設定
$email = &#8220;登録メールアドレス&#8220;;
$password = &#8220;登録パスワード&#8220;;
$host = &#8220;http://twitter.com/statuses/public_timeline.xml&#8221;;
$host .= &#8220;?since=&#8221;.urlencode(date(&#8217;D, d M Y G:i:s GMT&#8217;, strtotime(&#8217;-10 day&#8217;)));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, &#8220;$email:$password&#8221;);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
$result = curl_exec($ch);
curl_close($ch);
$XML = simplexml_load_string($result);
echo &#8220;&#60;ul&#62;&#8221;;
foreach ($XML-&#62;status as $status){
echo &#8220;&#60;li&#62;&#60;b style=\&#8221;color:red;\&#8221;&#62;&#8221;.$status-&#62;user-&#62;screen_name.&#8221;&#60;/b&#62;: &#8220;.$status-&#62;text.&#8221;&#60;/li&#62;&#60;hr&#62;\n&#8221;;
}
echo &#8220;&#60;/ul&#62;&#8221;;
?&#62;
&#60;p&#62;powerd by &#60;a href=&#8221;http://apiwiki.twitter.com/&#8221;&#62;Twitter API&#60;/a&#62;&#60;/p&#62;
&#60;/body&#62;
&#60;/html&#62;

こんな感じで、公開している名前とツイートを簡単に表示できた。
最新の表示はコチラ
]]></description>
			<content:encoded><![CDATA[<p>まずはTwitterへの登録が必要みたい。<br />
※APIを使用するにはメールアドレスとパスワードが必要。</p>
<p>早速 サンプル用<a title="Twitter" href="https://twitter.com/" target="_blank">Twitter</a>を登録してみる。</p>
<p>まずは簡単に表示できるかチェックしてみようってことで、<br />
<a href="http://watcher.moe-nifty.com/memo/docs/twitterAPI.txt" target="_blank">Twitter 仕様書</a>を参考にPHPで作ってみた。</p>
<p>Twitter APIの<a title="サンプル１" href="http://www.japan-l.com/design/twitter_1.php" target="_blank">サンプル</a></p>
<p>サンプルコードはコチラから</p>
<div style="color:blue;">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=utf-8&#8243;&gt;<br />
&lt;title&gt;Twitter API サンプル&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;Twitter API サンプル&lt;/h1&gt;<br />
&lt;?php</p>
<p>//ユーザーIDとパスワードの設定<br />
$email = &#8220;<span style="color:red;">登録メールアドレス</span>&#8220;;<br />
$password = &#8220;<span style="color:red;">登録パスワード</span>&#8220;;</p>
<p>$host = &#8220;http://twitter.com/statuses/public_timeline.xml&#8221;;<br />
$host .= &#8220;?since=&#8221;.urlencode(date(&#8217;D, d M Y G:i:s GMT&#8217;, strtotime(&#8217;-10 day&#8217;)));<br />
$ch = curl_init();</p>
<p>curl_setopt($ch, CURLOPT_URL, $host);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);<br />
curl_setopt($ch, CURLOPT_USERPWD, &#8220;$email:$password&#8221;);<br />
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);</p>
<p>$result = curl_exec($ch);<br />
curl_close($ch);<br />
$XML = simplexml_load_string($result);</p>
<p>echo &#8220;&lt;ul&gt;&#8221;;<br />
foreach ($XML-&gt;status as $status){<br />
echo &#8220;&lt;li&gt;&lt;b style=\&#8221;color:red;\&#8221;&gt;&#8221;.$status-&gt;user-&gt;screen_name.&#8221;&lt;/b&gt;: &#8220;.$status-&gt;text.&#8221;&lt;/li&gt;&lt;hr&gt;\n&#8221;;<br />
}<br />
echo &#8220;&lt;/ul&gt;&#8221;;</p>
<p>?&gt;<br />
&lt;p&gt;powerd by &lt;a href=&#8221;http://apiwiki.twitter.com/&#8221;&gt;Twitter API&lt;/a&gt;&lt;/p&gt;<br />
&lt;/body&gt;</p>
<p>&lt;/html&gt;
</p></div>
<p>こんな感じで、公開している名前とツイートを簡単に表示できた。<br />
最新の表示は<a title="PHPとTwitter" href="http://www.japan-l.com/design/twitter.php" target="_blank">コチラ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.japan-l.com/design/archives/170/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

