Skip to content
Miguel Angel Vallejo RockmanX!

Miguel A Vallejo

Established 1982, Network Engineer & Full Stack Developer

Recent Posts

  • Install Syncthing on Debian 11 or Proxmox LXC container
  • Installing MariaDB + PHPMyAdmin on Debian 11/Debian 11 Proxmox LXC Container
  • Fake Online Pet Store Scams Are On The Rise
  • The Inherit Dangers Of Nextdoor And How It’s Really Facebook 2.0
  • Install Redis NoSQL/Object Cache on Ubuntu Server 18 & 20 LTS

Recent Comments

  • Adventures in Owncloud - Part 2 - Security - Techbeast.net on Installing OwnCloud On Ubuntu Server 12.04 With SSL Support
  • Miguel on Can’t Map Windows Server 2003 Network Drive on Windows 7, Enter Network Password Error :(
  • Miguel on NIC Bonding In Ubuntu 12.04/12.04.2 WORKING!
  • Kumar on NIC Bonding In Ubuntu 12.04/12.04.2 WORKING!
  • Miguel on How to Remove LiveZilla’s Footer/Credits

Tag: Pulling Last Tweet From Twitter With PHP

Pulling Last Tweet From Twitter With PHP

So I made this post due the twitters infamous changes that screwed up my last script that pulled your last tweet via atom protocol…

Anyways I can’t take full credit for the script since part of it I got from Bradley Spencer, I simply added the formatting functionality after the tweet extraction which he did not provide on his blog ;)

[cc lang=”php”]

// set user name
$username=’websymantecs’;
// set format
$format=’json’;
//get tweets and decode them into a variable
$tweet=json_decode(file_get_contents(“http://api.twitter.com/1/statuses/user_timeline/{$username}.{$format}”));

//now lets take this variable/string and manipulate it to display it formatted correctly…

$link = strstr($tweet[0]->text, “http”);
$text = substr($tweet[0]->text, 0, strpos($tweet[0]->text, “http”));

echo $text . ‘‘.$link.’‘;

[/cc]

Posted on October 1, 2012January 31, 2013Categories Open Source Solutions, PHP, Web DevelopmentTags Pulling Last Tweet From Twitter With PHPLeave a comment on Pulling Last Tweet From Twitter With PHP
Proudly powered by WordPress