Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:25:58+00:00 2026-05-26T13:25:58+00:00

new here!! Im trying to get tweets to display on a site(framework is codeigniter).

  • 0

new here!!

Im trying to get tweets to display on a site(framework is codeigniter). I am using the twitter api (for example: https://api.twitter.com/1/statuses/user_timeline/ddarrko.xml) to get the tweets and subsequently insert them into a database which I will then get to display on the site. The actual code runs fine the issue is it only ever processes one tweet. my code is –

//get twitter address

    $this->load->model('admin_model');
    $getadd = $this->admin_model->get_settings("twitter_address");
    $twitter_user = $getadd->item_value;
    //define twitter xml file

    $xmlpath = "https://api.twitter.com/1/statuses/user_timeline/".$twitter_user.".xml";

    $xml = simplexml_load_file($xmlpath);


    foreach ($xml->status as $tweet);
    {
        echo "<pre>";print_r($xml);echo "</pre>";
        $this->data->username=$twitter_user;
        $this->data->twitter_status=$tweet->text;
        $this->data->pub_date=$tweet->created_at;

        //load model and insert tweets;
        $this->load->model('tweet_model');
        $this->tweet_model->insert_tweets($this->data);

    }

as you can see I am defining to run each status in xml file. The echo pre line is me testing because when printing $tweet only one tweet is coming up however even if i loop through just $xml still only one tweet is processed despite there being loads in the file.

any help/advice would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:25:58+00:00Added an answer on May 26, 2026 at 1:25 pm

    Below code will give you all the available tweets from XML. you can manipulate below logic as per your need.

    $xmlpath = "https://api.twitter.com/1/statuses/user_timeline/".$twitter_user.".xml";
    $xml = simplexml_load_file($xmlpath);
    $count_tweet = sizeof($xml);
    for($i=0 ; $i < $count_tweet  ; $i++)
    {
            echo"<br>Tweet: ". $xml->status[$i]->text;
            echo"<br>date:".$xml->status[$i]->created_at."<br>";
    }
    

    Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying out the twitter streaming api. I could succesfully filter tweets by using
Trying to follow someone on Twitter using new iOS 5 API, getting 406 return
I'm new here. I have been trying to create a video capture app using
I am trying to get the changelists on a directory using P4J. Here is
i am very new at jquery and code, here i am trying to get
I'm trying to get the basics down here of class definition and using a
Rails newbie here, trying to get a new controller working. When I try to
I am trying to get new content from database with php, here is the
Quite new to maven here so let me explain first what I am trying
I'm trying to subclass DataList to accept a new Command from embedded LinkButtons. Here's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.