{"id":712,"date":"2015-08-09T20:59:01","date_gmt":"2015-08-09T20:59:01","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=712"},"modified":"2018-07-10T19:53:59","modified_gmt":"2018-07-10T19:53:59","slug":"create-custom-twitter-widget-using-php","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/","title":{"rendered":"Create Custom Twitter Feed Widget using PHP"},"content":{"rendered":"<p>Twitter Embedded Timelines provides an easy way to display the latest tweets from the Twitter account on the website. You can add Twitter feed widget on the webpage by copy &#038; paste the embed code from the Twitter widgets creation section. But there is a limitation for styling the Twitter feed list as per the website design. Generally, the embedded timelines widget theme is not matched with the website layout. If you want to list the twitter feeds as per your website UI, it needs to be customized.<\/p>\n<p><b>Custom Twitter feed<\/b> helps to list the latest tweets of a Twitter account and customize the feed style as per your website UI. To create a custom Twitter feed you need to call the Twitter API. In this tutorial, we will show you how to get tweets from the Twitter account and create a <b>custom Twitter feed widget using Twitter API and PHP<\/b>.<\/p>\n<p>The following functionality will be implemented to build custom Twitter feed using PHP.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Authenticate with Twitter using TwitterOAuth PHP library.<\/li>\n<li>Retrieve Twitter feeds from the user timeline.<\/li>\n<li>Display the tweets or feed on the webpage.<\/li>\n<\/ul>\n<h2>Create Twitter App<\/h2>\n<p>To access Twitter API you need to create a Twitter App and generate the API key &#038; secret which need to be specified on API call. If you haven&#8217;t already created a Twitter App, follow this step-by-step guide to generate Access Token and API Keys &#8211; <a href=\"https:\/\/www.codexworld.com\/how-to-create-twitter-oauth-application\/\">How to Create Twitter OAuth Application<\/a><\/p>\n<p>Once your Twitter App is created, go to the <b>Keys and Access Tokens<\/b> page. In this <b>Application Settings<\/b> page, you&#8217;ll get these details &#8211; <b>Consumer Key<\/b> (API Key), <b>Consumer Secret<\/b> (API Secret), <b>Access Token<\/b>, and <b>Access Token Secret<\/b>. Note these credentials for later use in the script.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld.png\" alt=\"twitter-app-api-key-consumer-secret-access-token-codexworld\" width=\"993\" height=\"717\" class=\"alignnone size-full wp-image-3355\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld.png 993w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld-300x217.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld-768x555.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld-200x144.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/twitter-app-api-key-consumer-secret-access-token-codexworld-319x230.png 319w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/div>\n<h2>TwitterOAuth PHP Library<\/h2>\n<p>The TwitterOAuth library is used to authenticate with Twitter API and get the tweets from the user&#8217;s timeline using PHP. <\/p>\n<h2>Custom Twitter Feed using PHP<\/h2>\n<p>In the example code, we will fetch the latest tweets with user information from the Twitter account and display tweets in the custom feed widget.<\/p>\n<p><b>Retrieve Twitter Feed with User Information:<\/b><\/p>\n<ul class=\"bullet_disk_list\">\n<li>Include the TwitterOAuth library class file.<\/li>\n<li>Specify the Consumer Key, Consumer Secret, Access Token, and Access Token Secret as per your Twitter App Settings.<\/li>\n<li>Specify the Twitter account username.<\/li>\n<li>Specify the number of tweets you want to fetch from API.<\/li>\n<li>Initialize the TwitterOAuth class.<\/li>\n<li>Get the Twitter feeds using user_timeline API.<\/li>\n<\/ul>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Path&nbsp;to&nbsp;TwitterOAuth&nbsp;library<br \/><\/span><span style=\"color: #007700\">require_once(<\/span><span style=\"color: #DD0000\">\"twitteroauth\/TwitterOAuth.php\"<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/*<br \/>&nbsp;*&nbsp;Twitter&nbsp;App&nbsp;Settings<br \/>&nbsp;*&nbsp;Set&nbsp;access&nbsp;tokens&nbsp;and&nbsp;API&nbsp;keys<br \/>&nbsp;*\/<br \/><\/span><span style=\"color: #0000BB\">$consumerKey&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"YourTwitterAppConsumerKey\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$consumerSecret&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"YourTwitterAppConsumerSecret\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$accessToken&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"YourTwitterAppAccessToken\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$accessTokenSecret&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"YourTwitterAppAccessTokenSecret\"<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Twitter&nbsp;account&nbsp;username<br \/><\/span><span style=\"color: #0000BB\">$twitterID&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'codexworldblog'<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Number&nbsp;of&nbsp;tweets<br \/><\/span><span style=\"color: #0000BB\">$tweetNum&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">10<\/span><span style=\"color: #007700\">;<br \/>&nbsp;<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Authenticate&nbsp;with&nbsp;twitter<br \/><\/span><span style=\"color: #0000BB\">$twitterConnection&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">TwitterOAuth<\/span><span style=\"color: #007700\">(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$consumerKey<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$consumerSecret<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$accessToken<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$accessTokenSecret<br \/><\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;the&nbsp;user&nbsp;timeline&nbsp;feeds<br \/><\/span><span style=\"color: #0000BB\">$feedData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$twitterConnection<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">get<\/span><span style=\"color: #007700\">(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'statuses\/user_timeline'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'screen_name'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$twitterID<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'count'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$tweetNum<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'exclude_replies'&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">false<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">)<br \/>);<\/span><br\/><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p><b>Display User Information:<\/b><br \/>\nYou will get all the information about the tweet author using user object of $feedData.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;user&nbsp;info<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$profilePic&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">str_replace<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"normal\"<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">\"400x400\"<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$feedData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">profile_image_url_https<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$userName&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$feedData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">name<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$userScreenName&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$feedData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">screen_name<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$tweetsNum&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$feedData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">statuses_count<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$followerNum&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$feedData<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">]-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">followers_count<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n\r\n&lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"user-info\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">img<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$profilePic<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"img-thumbnail\"<\/span> \/>\r\n    &lt;<span style=\"color:#bf4f24\">h2<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userName<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">h2<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">a<\/span> <span style=\"color:#bf4f24\">href<\/span>=<span style=\"color:#0b6125\">\"https:\/\/twitter.com\/<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userScreenName<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span> <span style=\"color:#bf4f24\">target<\/span>=<span style=\"color:#0b6125\">\"_blank\"<\/span>>@<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$userScreenName<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">a<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n\r\n&lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-info\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"fnum\"<\/span>>&lt;<span style=\"color:#bf4f24\">div<\/span>>Tweets&lt;\/<span style=\"color:#bf4f24\">div<\/span>>&lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"badge\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweetsNum<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">div<\/span>>&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"fnum\"<\/span>>&lt;<span style=\"color:#bf4f24\">div<\/span>>Followers&lt;\/<span style=\"color:#bf4f24\">div<\/span>>&lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"badge\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$followerNum<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">div<\/span>>&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n<\/pre>\n<p><b>Display Tweets \/ Feeds \/ Posts:<\/b><br \/>\nThe following code list the latest tweets data with custom HTML element in the web page.<\/p>\n<pre style=\"background:#f9f9f9;color:#080808\">&lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-box\"<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">h2<\/span>>Latest Tweets&lt;\/<span style=\"color:#bf4f24\">h2<\/span>>\r\n    &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweets-widget\"<\/span>>            \r\n        &lt;<span style=\"color:#bf4f24\">ul<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-list\"<\/span>>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #0000BB\">&lt;?php<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">foreach(<\/span><span style=\"color: #0000BB\">$feedData&nbsp;<\/span><span style=\"color: #007700\">as&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">text<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">preg_replace<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'\/https:\\\/\\\/([a-z0-9_\\.\\-\\+\\&amp;\\!\\#\\~\\\/\\,]+)\/i'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;a&nbsp;href=\"https:\/\/$1\"&nbsp;target=\"_blank\"&gt;https:\/\/$1&lt;\/a&gt;'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">preg_replace<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'\/@([a-z0-9_]+)\/i'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;a&nbsp;class=\"tweet-author\"&nbsp;href=\"https:\/\/twitter.com\/$1\"&nbsp;target=\"_blank\"&gt;@$1&lt;\/a&gt;'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$tweetTime&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">date<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"D&nbsp;M&nbsp;d&nbsp;H:i:s\"<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #0000BB\">strtotime<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">created_at<\/span><span style=\"color: #007700\">));<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n            &lt;<span style=\"color:#bf4f24\">li<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-wrapper\"<\/span>>\r\n                &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-thumb\"<\/span>>\r\n                    &lt;<span style=\"color:#bf4f24\">span<\/span>>&lt;<span style=\"color:#bf4f24\">a<\/span> <span style=\"color:#bf4f24\">href<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">url<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span> <span style=\"color:#bf4f24\">title<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">name<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span>>&lt;<span style=\"color:#bf4f24\">img<\/span> <span style=\"color:#bf4f24\">alt<\/span>=<span style=\"color:#0b6125\">\"\"<\/span> <span style=\"color:#bf4f24\">src<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">user<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">profile_image_url<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span>>&lt;\/<span style=\"color:#bf4f24\">a<\/span>>&lt;\/<span style=\"color:#bf4f24\">span<\/span>>\r\n                &lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n                &lt;<span style=\"color:#bf4f24\">div<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"tweet-content\"<\/span>>\r\n                    &lt;<span style=\"color:#bf4f24\">h3<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"title\"<\/span> <span style=\"color:#bf4f24\">title<\/span>=<span style=\"color:#0b6125\">\"<span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">text<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$latestTweet<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>&lt;\/<span style=\"color:#bf4f24\">h3<\/span>>\r\n                    &lt;<span style=\"color:#bf4f24\">span<\/span> <span style=\"color:#bf4f24\">class<\/span>=<span style=\"color:#0b6125\">\"meta\"<\/span>><span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweetTime<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span> - <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #0000BB\">$tweet<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">favorite_count<\/span><span style=\"color: #007700\">;&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span> Favorite&lt;\/<span style=\"color:#bf4f24\">span<\/span>>\r\n                &lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n            &lt;\/<span style=\"color:#bf4f24\">li<\/span>>\r\n        <span style=\"color: #0000BB\">&lt;?php&nbsp;<\/span><span style=\"color: #007700\">}&nbsp;<\/span><span style=\"color: #0000BB\">?&gt;<\/span>\r\n        &lt;\/<span style=\"color:#bf4f24\">ul<\/span>>\r\n    &lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n&lt;\/<span style=\"color:#bf4f24\">div<\/span>>\r\n<\/pre>\n<h2>Information Returned by Twitter API<\/h2>\n<p>After the autentication, the Twitter API returned various information about the user and tweets. The following informations are some of the commonly used in Twitter Feed.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>User Information (user)\n<ul>\n<li>User ID (id)<\/li>\n<li>User Name (name)<\/li>\n<li>User Screen Name (screen_name)<\/li>\n<li>User Location (location)<\/li>\n<li>Followers Count (followers_count)<\/li>\n<li>Friends Count (friends_count)<\/li>\n<li>Tweets Count (statuses_count)<\/li>\n<li>Profile Background Image  (profile_background_image_url | profile_background_image_url_https)<\/li>\n<li>Profile Image (profile_image_url | profile_image_url_https)<\/li>\n<li>Profile Banner  (profile_banner_url)<\/li>\n<\/ul>\n<\/li>\n<li>Tweet Post Date (created_at)<\/li>\n<li>Tweet ID (id) <\/li>\n<li>Tweet Text (text)<\/li>\n<li>URLs (urls)<\/li>\n<li>Geo Data (geo)<\/li>\n<li>Retweet Count (retweet_count)<\/li>\n<li>Favorite Count (favorite_count)<\/li>\n<\/ul>\n<p class=\"seeAlso\"><span><\/span><a href=\"https:\/\/www.codexworld.com\/login-with-twitter-using-php\/\">Login with Twitter using PHP<\/a><\/span><\/p>\n<h2>Custom Twitter Feed Styling<\/h2>\n<p>The Twitter feed is fetched via API and listed with custom HTML element. So, you can customize the Twitter feed list as per your requirement. The following CSS specifies the custom style for the Twiiter feed widget.<\/p>\n<pre><span style=\"color:#bf4f24\">.tweet-box<\/span>{\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">100<span style=\"color:#794938\">%<\/span><\/span>;\r\n    <span style=\"color:#691c97\">border<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">1<span style=\"color:#794938\">px<\/span><\/span> <span style=\"color:#b4371f\">solid<\/span> <span style=\"color:#811f24;font-weight:700\">#e8e8e8<\/span>;\r\n    <span style=\"color:#691c97\">margin-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">10<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">margin-top<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">10<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">background-color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#fff<\/span>;\r\n    <span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">5<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">float<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">left<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-box<\/span> <span style=\"color:#bf4f24\">h2<\/span> {\r\n    <span style=\"color:#691c97\">font-family<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#0b6125\">'Arial Black'<\/span>, Gadget, <span style=\"color:#b4371f\">sans-serif<\/span>;\r\n    <span style=\"color:#691c97\">font-size<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">18<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#444<\/span>;\r\n    <span style=\"color:#691c97\">border-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">1<span style=\"color:#794938\">px<\/span><\/span> <span style=\"color:#b4371f\">solid<\/span> <span style=\"color:#811f24;font-weight:700\">#E5E5E5<\/span>;\r\n    <span style=\"color:#691c97\">padding<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">10<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">margin<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweets-widget<\/span> {\r\n    <span style=\"color:#691c97\">list-style<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">none<\/span>;\r\n    <span style=\"color:#691c97\">max-height<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">450<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">position<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">relative<\/span>;\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">100<span style=\"color:#794938\">%<\/span><\/span>;\r\n    <span style=\"color:#691c97\">overflow-x<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">hidden<\/span>;\r\n    <span style=\"color:#691c97\">overflow-y<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">scroll<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweets-widget<\/span> <span style=\"color:#bf4f24\">ul<\/span> {\r\n    <span style=\"color:#691c97\">margin-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">padding-left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">100<span style=\"color:#794938\">%<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-wrapper<\/span> {\r\n    <span style=\"color:#691c97\">border-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">1<span style=\"color:#794938\">px<\/span><\/span> <span style=\"color:#b4371f\">solid<\/span> <span style=\"color:#811f24;font-weight:700\">#E5E5E5<\/span>;\r\n    <span style=\"color:#691c97\">padding-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">15<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">100<span style=\"color:#794938\">%<\/span><\/span>;\r\n    <span style=\"color:#691c97\">overflow<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">hidden<\/span>;\r\n    <span style=\"color:#691c97\">padding-left<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">10<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-wrapper<\/span><span style=\"color:#bf4f24\">:last-child<\/span> {\r\n    <span style=\"color:#691c97\">border-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">none<\/span>;\r\n    <span style=\"color:#691c97\">margin-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-thumb<\/span> {\r\n    <span style=\"color:#691c97\">float<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">left<\/span>;\r\n    <span style=\"color:#691c97\">margin-right<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">15<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">margin-top<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">5<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">h3<\/span><span style=\"color:#bf4f24\">.title<\/span> <span style=\"color:#bf4f24\">a<\/span>{<span style=\"color:#691c97\">color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#4c9fe1<\/span>;}\r\n<span style=\"color:#bf4f24\">h3<\/span><span style=\"color:#bf4f24\">.title<\/span> <span style=\"color:#bf4f24\">a<\/span><span style=\"color:#bf4f24\">:hover<\/span>{<span style=\"color:#691c97\">text-decoration<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">underline<\/span>;}\r\n<span style=\"color:#bf4f24\">.tweets-widget<\/span> <span style=\"color:#bf4f24\">img<\/span> {\r\n    <span style=\"color:#691c97\">max-width<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">100<span style=\"color:#794938\">%<\/span><\/span>;\r\n    <span style=\"color:#691c97\">border<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<\/span>;\r\n    <span style=\"color:#691c97\">vertical-align<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">middle<\/span>;\r\n    <span style=\"color:#691c97\">height<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">auto<\/span>;\r\n    <span style=\"color:#691c97\">background<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#fff<\/span>;\r\n    <span style=\"color:#691c97\">display<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">block<\/span>;\r\n    <span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n    -moz-<span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n    -webkit-<span style=\"color:#691c97\">border-radius<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-content<\/span> {\r\n    <span style=\"color:#691c97\">overflow<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#b4371f\">hidden<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-content<\/span> <span style=\"color:#bf4f24\">.title<\/span> {\r\n    <span style=\"color:#691c97\">margin-top<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">5<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">margin-bottom<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">0<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">line-height<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">19<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">font-size<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">14<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">font-family<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#0b6125\">'Arial'<\/span>;\r\n}\r\n<span style=\"color:#bf4f24\">.tweet-content<\/span> <span style=\"color:#bf4f24\">.meta<\/span> {\r\n    <span style=\"color:#691c97\">font-size<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">11<span style=\"color:#794938\">px<\/span><\/span>;\r\n    <span style=\"color:#691c97\">color<\/span><span style=\"color:#794938\">:<\/span> <span style=\"color:#811f24;font-weight:700\">#929292<\/span>;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Twitter Embedded Timelines provides an easy way to display the latest tweets from the Twitter account on the website. You can add Twitter feed widget on the webpage by copy &#038; paste the embed code <\/p>\n","protected":false},"author":1,"featured_media":3354,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[14,37,41,40],"class_list":["post-712","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php","tag-twitter","tag-twitter-feed","tag-twitter-widget","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create Custom Twitter Feed Widget using PHP - CodexWorld<\/title>\n<meta name=\"description\" content=\"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create Custom Twitter Feed Widget using PHP - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-09T20:59:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-07-10T19:53:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Create Custom Twitter Feed Widget using PHP\",\"datePublished\":\"2015-08-09T20:59:01+00:00\",\"dateModified\":\"2018-07-10T19:53:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/\"},\"wordCount\":601,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png\",\"keywords\":[\"PHP\",\"Twitter\",\"Twitter Feed\",\"Twitter Widget\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/\",\"name\":\"Create Custom Twitter Feed Widget using PHP - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png\",\"datePublished\":\"2015-08-09T20:59:01+00:00\",\"dateModified\":\"2018-07-10T19:53:59+00:00\",\"description\":\"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"create-custom-twitter-feed-widget-tweets-php-api-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/create-custom-twitter-widget-using-php\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Custom Twitter Feed Widget using PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create Custom Twitter Feed Widget using PHP - CodexWorld","description":"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/","og_locale":"en_US","og_type":"article","og_title":"Create Custom Twitter Feed Widget using PHP - CodexWorld","og_description":"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.","og_url":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2015-08-09T20:59:01+00:00","article_modified_time":"2018-07-10T19:53:59+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Create Custom Twitter Feed Widget using PHP","datePublished":"2015-08-09T20:59:01+00:00","dateModified":"2018-07-10T19:53:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/"},"wordCount":601,"commentCount":6,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","keywords":["PHP","Twitter","Twitter Feed","Twitter Widget"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/","url":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/","name":"Create Custom Twitter Feed Widget using PHP - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","datePublished":"2015-08-09T20:59:01+00:00","dateModified":"2018-07-10T19:53:59+00:00","description":"Custom Twitter feed widget - Get tweets from user timeline using Twitter API and PHP. Example code to retrieve tweets from Twitter account and display custom feed in the website using PHP.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","width":1366,"height":768,"caption":"create-custom-twitter-feed-widget-tweets-php-api-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/create-custom-twitter-widget-using-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Create Custom Twitter Feed Widget using PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/08\/create-custom-twitter-feed-widget-tweets-php-api-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-bu","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/712","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=712"}],"version-history":[{"count":8,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/712\/revisions"}],"predecessor-version":[{"id":3358,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/712\/revisions\/3358"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/3354"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=712"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=712"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=712"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}