Run controller from an external site

Asked

Viewed 61 times

1

I have the following problem/question:

I have the Wordpress installed and the CodeIgniter also. In Codeigniter I have to make a function that add +1 in the database when a category is seen in the wordpress. Then the following code inside a controller of codeigniter

<?php
function add($id){

$this->db->where('id', $id);
$banner = $this->db->get('banners')->row();
$add = $banner->views + 1;

$this->db->where('id', $id);
$this->db->update('banners', array('views'=>$add));

return true;
?>

I need to run this code every time someone goes into a wordpress. I thought I’d do it using file_get_contents() but I don’t know if it will work because it picks up the contents of a link. I wonder how I can do it. The wordpress related to categories I already know, the problem is only in doing/using a function to execute when entering or updating the page because I want to make a banner display system.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.