I have two instances of Craft on the same server. From within a plugin controller in Craft #1, I want to be able to get entries from Craft #2. Can this be done and if so, how?


Indeed... this will do it:

$craft = require '../other/craft/app/bootstrap.php';
$entry = $craft->entries->getEntryById($id);

echo 'Other Craft install entry title:'.$entry->title;
  • Because: Fatal error: Cannot redeclare craft_createFolder() (previously declared in /path/to/second/craft/app/bootstrap.php:30) in /path/to/first/craft/app/bootstrap.php on line 52
    – Paul
    Apr 19 '15 at 19:33
  • 1
    Well... I did say it was untested. :) I think that should work, though, so that's a potential bug. Will look into it.
    – Brad Bell
    Apr 19 '15 at 19:35
  • Cool. I'm in a bit of a hurry, though, so will use a workaround for now.
    – Paul
    Apr 19 '15 at 19:36
  • I supposed I went back and fixed this at one point because it works now. :)
    – Brad Bell
    Oct 16 '15 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.