Welcome Guest, Not a member yet? Register   Sign In
issue accessing CI with curl?
#1

[eluser]gedev2006[/eluser]
Hi

I have an issue im just not understanding.

Im using curl in an external script to access a CI controller. Lets say for example

Code:
$_curl = curl_init ( "http://test.com/index.php/test/example" );
$_result = curl_exec( $_curl );

So, this works fine, lets say the controller looks like this:

Code:
class Test extends Controller {

    public function example(){

        $this->load->model ( 'testing' );

        $_data = $this->testing->test();


        echo $_data;

    }

}

All good so far. So lets look at the model:

Code:
class Testing extends Model {

    public function test() {

       $_result = $this->db->query ( "QUERY STRING HERE");

    }

}

ok so i stopped the code there. because im getting the following error:

[quote]Fatal error: Using $this when not in object context[/code]

but...if i create the model like this:

Code:
$Model =& new Model();
$Model->db->query ( "QUERY STRING HERE");

it works fine!

so whats with the error?


Messages In This Thread
issue accessing CI with curl? - by El Forum - 10-12-2009, 03:24 PM
issue accessing CI with curl? - by El Forum - 10-12-2009, 10:39 PM
issue accessing CI with curl? - by El Forum - 10-12-2009, 11:56 PM
issue accessing CI with curl? - by El Forum - 10-13-2009, 02:27 AM
issue accessing CI with curl? - by El Forum - 10-13-2009, 02:35 AM
issue accessing CI with curl? - by El Forum - 10-13-2009, 02:40 AM
issue accessing CI with curl? - by El Forum - 10-13-2009, 03:28 AM
issue accessing CI with curl? - by El Forum - 10-13-2009, 03:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB