0

cotroller function:

function getFeed() {

    $content = file_get_contents($this->input->post('rss_url'));
    $x = new SimpleXmlElement($content);    

    foreach($x->channel->item as $entry) {
        $feeds[] = array(
            'title' => (string)$entry->title,
            'link' => (string)$entry->link,
            'username' => $this->session->userdata('username'),
            'rss_source' => $this->input->post('rss_url')
        );
    }

    $this->load->model('membership_model');
    $this->membership_model->insert_feeds($feeds);

}

model:

function insert_feeds($feeds_data)
{
    $this->db->insert_batch('feeds',$feeds_data);
}

I have a form where I put a feed url.

This feed url is stored into a database. The database looks like this:

- id (which is the primary key)
- title (title of every item from the xml file)
- link (of every item from xml file)
- username (the username who put the feed url into the form)
- rss_source (the url that the user puts into the form).

What I want to do is to make a cron job who insert every 2 days new rows in the database.

I must make another controller function like the getfeed function, who is getting the contents from the database rss sources and put them in new rows with the same model function?

duellsy
  • 8,497
  • 2
  • 36
  • 60
user3313651
  • 105
  • 1
  • 1
  • 8
  • There are also many [similar](http://stackoverflow.com/questions/19269566/how-to-set-cron-job-url-for-codeigniter) [topics](http://stackoverflow.com/questions/15558830/codeigniter-cron-job-through-cpanel) on SO. – Hashem Qolami Mar 01 '14 at 08:42
  • i need help for the CI part first. – user3313651 Mar 01 '14 at 08:44

0 Answers0