<?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>twitter feed api Archives - Cody Paste</title>
	<atom:link href="https://www.codypaste.com/tag/twitter-feed-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codypaste.com/tag/twitter-feed-api/</link>
	<description>THE WEB PLAYGROUND</description>
	<lastBuildDate>Mon, 01 May 2017 12:03:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.codypaste.com/wp-content/uploads/2022/12/cropped-codypaste-32x32.png</url>
	<title>twitter feed api Archives - Cody Paste</title>
	<link>https://www.codypaste.com/tag/twitter-feed-api/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Twitter Feed API</title>
		<link>https://www.codypaste.com/twitter-feed-api/</link>
					<comments>https://www.codypaste.com/twitter-feed-api/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Mon, 01 May 2017 12:02:04 +0000</pubDate>
				<category><![CDATA[Cool Effect]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[twitter feed api]]></category>
		<guid isPermaLink="false">http://www.codypaste.com/?p=590</guid>

					<description><![CDATA[<p>Go to https://apps.twitter.com/ and create App [crayon-6985e7a140da9105792684/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/twitter-feed-api/">Twitter Feed API</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Go to <a href="https://apps.twitter.com/" target="_blank">https://apps.twitter.com/</a> and create App</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php
    function buildBaseString($baseURI, $method, $params) {
        $r = array();
        ksort($params);
        foreach($params as $key=&gt;$value){
            $r[] = "$key=" . rawurlencode($value);
        }
        return $method."&amp;" . rawurlencode($baseURI) . '&amp;' . rawurlencode(implode('&amp;', $r));
    }

    function buildAuthorizationHeader($oauth) {
        $r = 'Authorization: OAuth ';
        $values = array();
        foreach($oauth as $key=&gt;$value)
            $values[] = "$key=\"" . rawurlencode($value) . "\"";
        $r .= implode(', ', $values);
        return $r;
    }

    $url = "https://api.twitter.com/1.1/statuses/user_timeline.json";

    $oauth_access_token = "your access token goes here";
    $oauth_access_token_secret = "your access token secret goes here";
    $consumer_key = "your consumer key goes here";
    $consumer_secret = "your consumer secret goes here";

    $oauth = array( 'oauth_consumer_key' =&gt; $consumer_key,
                    'oauth_nonce' =&gt; time(),
                    'oauth_signature_method' =&gt; 'HMAC-SHA1',
                    'oauth_token' =&gt; $oauth_access_token,
                    'oauth_timestamp' =&gt; time(),
                    'oauth_version' =&gt; '1.0');

    $base_info = buildBaseString($url, 'GET', $oauth);
    $composite_key = rawurlencode($consumer_secret) . '&amp;' . rawurlencode($oauth_access_token_secret);
    $oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
    $oauth['oauth_signature'] = $oauth_signature;

    // Make requests
    $header = array(buildAuthorizationHeader($oauth), 'Expect:');
    $options = array( CURLOPT_HTTPHEADER =&gt; $header,
                      //CURLOPT_POSTFIELDS =&gt; $postfields,
                      CURLOPT_HEADER =&gt; false,
                      CURLOPT_URL =&gt; $url,
                      CURLOPT_RETURNTRANSFER =&gt; true,
                      CURLOPT_SSL_VERIFYPEER =&gt; false);

    $feed = curl_init();
    curl_setopt_array($feed, $options);
    $json = curl_exec($feed);
    curl_close($feed);

    $twitter_data = json_decode($json);

//print it out
print_r ($twitter_data);

?&gt;

&lt;?php echo $twitter_data[0]-&gt;text; ?&gt;&lt;br /&gt;
Created: &lt;?php echo $twitter_data[0]-&gt;created_at; ?&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;?php echo $twitter_data[1]-&gt;text; ?&gt;&lt;br /&gt;
Created: &lt;?php echo $twitter_data[1]-&gt;created_at; ?&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;?php echo $twitter_data[2]-&gt;text; ?&gt;&lt;br /&gt;
Created: &lt;?php echo $twitter_data[2]-&gt;created_at; ?&gt;
&lt;br /&gt;&lt;br /&gt;</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/twitter-feed-api/">Twitter Feed API</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/twitter-feed-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
