1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error when try to create my own api.

Discussion in 'XenForo Development Discussions' started by timothy259856, Nov 25, 2015.

  1. timothy259856

    timothy259856 Active Member

    Hi,

    I've try to create my own api (bridge) to work with XenForo core, here is my demo api.php code:

    PHP:
    <?php
        error_reporting
    (-1);
        
    ini_set("display_errors"1);   
        
    /**
        *** INIT XF
        **/
        
    define('SCRIPT_ROOT', empty($_SERVER['SCRIPT_FILENAME']) ? '../' dirname(dirname($_SERVER['SCRIPT_FILENAME'])).'/');
        require_once(
    SCRIPT_ROOT'/library/XenForo/Autoloader.php');
        
    XenForo_Autoloader::getInstance()->setupAutoloader(SCRIPT_ROOT'/library');
        
    XenForo_Application::initialize(SCRIPT_ROOT '/library'SCRIPT_ROOT);
        
    XenForo_Application::set('page_start_time'microtime(TRUE));

        
    $deps = new XenForo_Dependencies_Public();
        
    $deps->preLoadData();
        exit();
    ?>
    This is my forum struct:

    xf_dir
    -------index.php
    -------api/
    -----------api.php

    And I always see this error:
    Any idea? Look like the cache_dir is wrong here, but I don't know where to fix. Thanks
     

Share This Page