We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to access EE API from a non-EE PHP page?

Development and Programming

David Hyland's avatar
David Hyland
210 posts
15 years ago
David Hyland's avatar David Hyland

Hi there.

I have a simple PHP page, on the same domain, which is to be called via an ajax request. The PHP page is to perform a custom query on the database and return JSON encoded data.

I could easily manually create database connections but is there a way to plug into the EE API to take advantage of all the Direct Record functions?

       
Jamie Rumbelow's avatar
Jamie Rumbelow
546 posts
15 years ago
Jamie Rumbelow's avatar Jamie Rumbelow

You can access the entirety of your ExpressionEngine system really easily by just requiring your index.php file in an output buffer. You can then use the get_instance() function to access the ExpressionEngine/CodeIgniter system.

ob_start();
    require '/path/to/index.php';
ob_end_clean();

$EE =& get_instance();
       
David Hyland's avatar
David Hyland
210 posts
15 years ago
David Hyland's avatar David Hyland

Nice one, thanks Jamie!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.