I had two CI projects in my local machine named client & server. The client has a controller Welcome which has two functions __controller() & greet() with echo statements "hello from controller" and "hello from greet" respectively. The server has a controller named cron which has a function test() with the following piece of code:
$opts = array('http' =>
array(
'method' => 'GET',
'timeout' => 10
)
);
$context = stream_context_create($opts);
$url = "http://localhost:2016/Welcome/greet/";
echo $url . PHP_EOL;
var_dump(file_get_contents($url, TRUE, $context));
When I accessed the test controller through browser, it displayed Hello from controller. Hello from greet. as I had expected.
Later I moved both server & client projects to two different LAMP servers and accessed the same test controller through my browser but the result was only Hello from controller. Am I missing something here?