Twitter API Callback Tutorial

The Twitter API includes a callback function you use to display tweets in your website layout. You can display your latest tweets or tweets from other followers or users on your Web page. You use PHP to retrieve the list of tweets and display them in a specified container. The Twitter API handles all of the necessary searches, so you just need to display the results on your page.

Instructions

    • 1

      Right-click the PHP page you want to edit and select "Open With." Click your preferred PHP editor to load the page in the editor.

    • 2

      Link to your Twitter feed. The Twitter API requires your username to link to your tweets. You can also link to another user's tweets, if you prefer. Add the following code to link to your account:

      $tweets= "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";

      Replace "$username" with your Twitter account name.

    • 3

      Display the tweets in a div container. Locate the section of code in your page in which you want to display the data. Add the following code to the container:

      $content = explode("<content type=\"html\">", $tweets);
      $content2 = explode("</content>", $content[1]);
      echo $content2;

Related Searches:

References

Comments

Related Ads

Featured